test: bootstrap Vitest coverage across JS workspaces#1841
test: bootstrap Vitest coverage across JS workspaces#1841partyplatter08-lab wants to merge 5 commits into
Conversation
| @@ -0,0 +1 @@ | |||
| export {}; | |||
There was a problem hiding this comment.
Empty setup file has misleading name
The file is registered as a Vitest setupFile in ui-solid/vitest.config.ts and its name implies it should extend Vitest's expect with @testing-library/jest-dom matchers (e.g. toBeInTheDocument, toHaveAttribute). Currently it only exports an empty object, so any future test that calls those matchers will fail with a cryptic "is not a function" error rather than a clear "jest-dom not configured" message. If DOM matchers are not needed, the setupFiles entry and this file should be removed; if they are needed, the file should contain import "@testing-library/jest-dom" and the package should be added as a dev dependency.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/ui-solid/src/jest-dom.setup.ts
Line: 1
Comment:
**Empty setup file has misleading name**
The file is registered as a Vitest `setupFile` in `ui-solid/vitest.config.ts` and its name implies it should extend Vitest's `expect` with `@testing-library/jest-dom` matchers (e.g. `toBeInTheDocument`, `toHaveAttribute`). Currently it only exports an empty object, so any future test that calls those matchers will fail with a cryptic "is not a function" error rather than a clear "jest-dom not configured" message. If DOM matchers are not needed, the `setupFiles` entry and this file should be removed; if they are needed, the file should contain `import "@testing-library/jest-dom"` and the package should be added as a dev dependency.
How can I resolve this? If you propose a fix, please make it concise.| describe("storybook Vite config", () => { | ||
| it("loads Solid and Cap UI plugins", () => { | ||
| expect(Array.isArray(config.plugins)).toBe(true); | ||
| expect(config.plugins).toHaveLength(2); |
There was a problem hiding this comment.
Plugin-count assertion is fragile
toHaveLength(2) checks the number of top-level entries in the raw plugins array literal — it passes regardless of whether the plugins are correct objects and will break silently when a third plugin is added to the config. Consider asserting on plugin identity instead (e.g. checking a plugin's name field), or at minimum checking >= 2.
| expect(config.plugins).toHaveLength(2); | |
| expect(config.plugins!.length).toBeGreaterThanOrEqual(2); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/storybook/storybook-vite.test.ts
Line: 7
Comment:
**Plugin-count assertion is fragile**
`toHaveLength(2)` checks the number of top-level entries in the raw `plugins` array literal — it passes regardless of whether the plugins are correct objects and will break silently when a third plugin is added to the config. Consider asserting on plugin identity instead (e.g. checking a plugin's `name` field), or at minimum checking `>= 2`.
```suggestion
expect(config.plugins!.length).toBeGreaterThanOrEqual(2);
```
How can I resolve this? If you propose a fix, please make it concise.…bounty-54 # Conflicts: # apps/desktop/package.json # pnpm-lock.yaml
|
AI-assisted follow-up on the Greptile findings:
Verified locally: pnpm install --frozen-lockfile --ignore-scripts
pnpm --filter=@cap/ui-solid test
pnpm --filter=@cap/storybook test
pnpm test --filter=@cap/desktop --filter=@cap/storybook --filter=@cap/web-cluster --filter=config --filter=@cap/database --filter=@cap/env --filter=@cap/sdk-embed --filter=@cap/sdk-recorder --filter=tsconfig --filter=@cap/utils --filter=@cap/web-api-contract --filter=@cap/web-api-contract-effect --filter=@cap/web-backend --filter=@cap/web-domain --filter=@cap/ui --filter=@cap/ui-solid
pnpm exec biome check apps/desktop/package.json apps/storybook/package.json apps/storybook/vitest.config.ts apps/storybook/storybook-vite.test.ts apps/web-cluster/package.json apps/web-cluster/vitest.config.ts apps/web-cluster/src/cluster/container-metadata.test.ts packages/config/package.json packages/config/vitest.config.ts packages/config/vite/relativeAliasResolver.test.ts packages/database/package.json packages/database/vitest.config.ts packages/database/crypto.test.ts packages/env/package.json packages/env/vitest.config.ts packages/env/build.test.ts packages/sdk-embed/package.json packages/sdk-embed/vitest.config.ts packages/sdk-embed/src/vanilla/cap-embed.test.ts packages/sdk-recorder/package.json packages/sdk-recorder/vitest.config.ts packages/sdk-recorder/src/core/mime-types.test.ts packages/tsconfig/package.json packages/tsconfig/vitest.config.ts packages/tsconfig/base.test.ts packages/utils/package.json packages/utils/vitest.config.ts packages/utils/src/helpers.test.ts packages/web-api-contract/package.json packages/web-api-contract/vitest.config.ts packages/web-api-contract/src/desktop.test.ts packages/web-api-contract-effect/package.json packages/web-api-contract-effect/vitest.config.ts packages/web-api-contract-effect/src/index.test.ts packages/web-backend/package.json packages/web-backend/vitest.config.ts packages/web-backend/src/Videos/EffectiveVideoRules.test.ts packages/web-domain/package.json packages/web-domain/vitest.config.ts packages/web-domain/src/utils.test.ts packages/ui/package.json packages/ui/vitest.config.ts packages/ui/src/components/Button.test.tsx packages/ui-solid/package.json packages/ui-solid/vitest.config.ts packages/ui-solid/src/ProgressCircle.test.tsx packages/ui-solid/src/jest-dom.setup.ts
git diff --checkThe full filtered test matrix finished with 16/16 tasks successful, and Biome reported |
/claim #54
Summary
testscripts into the existing Turbopnpm testpipeline for desktop, Storybook, web-cluster, and shared JS/TS packages that were missing them.Review follow-up
solidandunplugin-icons) instead of asserting a fragile raw plugin-array length.packages/ui-solidnow has a realsrc/jest-dom.setup.tsimporting@testing-library/jest-dom/vitest, wired throughsetupFiles, so DOM matcher tests are initialized when needed.Validation
pnpm install --frozen-lockfile --ignore-scriptspnpm --filter=@cap/ui-solid testpnpm --filter=@cap/storybook testpnpm test --filter=@cap/desktop --filter=@cap/storybook --filter=@cap/web-cluster --filter=config --filter=@cap/database --filter=@cap/env --filter=@cap/sdk-embed --filter=@cap/sdk-recorder --filter=tsconfig --filter=@cap/utils --filter=@cap/web-api-contract --filter=@cap/web-api-contract-effect --filter=@cap/web-backend --filter=@cap/web-domain --filter=@cap/ui --filter=@cap/ui-solid-> 16/16 tasks successfulpnpm exec biome check apps/desktop/package.json apps/storybook/package.json apps/storybook/vitest.config.ts apps/storybook/storybook-vite.test.ts apps/web-cluster/package.json apps/web-cluster/vitest.config.ts apps/web-cluster/src/cluster/container-metadata.test.ts packages/config/package.json packages/config/vitest.config.ts packages/config/vite/relativeAliasResolver.test.ts packages/database/package.json packages/database/vitest.config.ts packages/database/crypto.test.ts packages/env/package.json packages/env/vitest.config.ts packages/env/build.test.ts packages/sdk-embed/package.json packages/sdk-embed/vitest.config.ts packages/sdk-recorder/package.json packages/sdk-recorder/vitest.config.ts packages/sdk-recorder/src/core/mime-types.test.ts packages/tsconfig/package.json packages/tsconfig/vitest.config.ts packages/tsconfig/base.test.ts packages/utils/package.json packages/utils/vitest.config.ts packages/utils/src/helpers.test.ts packages/web-api-contract/package.json packages/web-api-contract/vitest.config.ts packages/web-api-contract/src/desktop.test.ts packages/web-api-contract-effect/package.json packages/web-api-contract-effect/vitest.config.ts packages/web-api-contract-effect/src/index.test.ts packages/web-backend/package.json packages/web-backend/vitest.config.ts packages/web-backend/src/Videos/EffectiveVideoRules.test.ts packages/web-domain/package.json packages/web-domain/vitest.config.ts packages/web-domain/src/utils.test.ts packages/ui/package.json packages/ui/vitest.config.ts packages/ui/src/components/Button.test.tsx packages/ui-solid/package.json packages/ui-solid/vitest.config.ts packages/ui-solid/src/ProgressCircle.test.tsx packages/ui-solid/src/jest-dom.setup.ts->Checked 47 files... No fixes appliedgit diff --checkPrepared with Codex assistance.