test: bootstrap Vitest coverage across JS workspaces#1841
test: bootstrap Vitest coverage across JS workspaces#1841partyplatter08-lab wants to merge 3 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.
Summary
/claim #54
testscripts into the existing Turbopnpm testpipeline for desktop, Storybook, web-cluster, and shared JS/TS packages that were missing themValidation
pnpm install --frozen-lockfile --ignore-scriptspnpm 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-solidpnpm 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.tsGreptile Summary
This PR bootstraps Vitest coverage across 16 JS/TS workspaces that previously had no test scripts, adding
vitest.config.tsfiles, package-localvitestdev dependencies, and example test suites for each package.\"test\": \"vitest run\"into the Turbo pipeline for desktop, storybook, web-cluster, and all touched packages, with consistent~2.1.9version pinning and matching lockfile updates.ui-solidsetup file (jest-dom.setup.ts) is registered as a vitestsetupFilebut is empty — no dom matchers are configured — and the storybook plugin-count assertion hardcodes the raw array length rather than checking plugin identity.Confidence Score: 4/5
Safe to merge; the new test files and configs are additive and don't touch any production code paths.
All 16 new test suites exercise real logic and the assertions have been verified against their implementations. The two findings are limited to a misleading empty setup file and a fragile plugin-count assertion — neither affects production behavior or breaks the new tests as written.
packages/ui-solid/src/jest-dom.setup.ts — registered as a setup file but empty, which will silently break any future test that relies on dom matchers.
Important Files Changed
export {}— dom matchers are never configuredPrompt To Fix All With AI
Reviews (1): Last reviewed commit: "chore: revise bounty claim package" | Re-trigger Greptile