Skip to content

test: bootstrap Vitest coverage across JS workspaces#1841

Open
partyplatter08-lab wants to merge 5 commits into
CapSoftware:mainfrom
partyplatter08-lab:partyplatter08-lab/bounty-54
Open

test: bootstrap Vitest coverage across JS workspaces#1841
partyplatter08-lab wants to merge 5 commits into
CapSoftware:mainfrom
partyplatter08-lab:partyplatter08-lab/bounty-54

Conversation

@partyplatter08-lab
Copy link
Copy Markdown

@partyplatter08-lab partyplatter08-lab commented May 19, 2026

/claim #54

Summary

  • Wire package-level test scripts into the existing Turbo pnpm test pipeline for desktop, Storybook, web-cluster, and shared JS/TS packages that were missing them.
  • Add minimal Vitest configs so each new suite has an explicit local test entrypoint.
  • Add example tests covering desktop suites, Storybook Vite config, web-cluster metadata resolution, shared Vite alias resolution, database password hashing, env public URL fallback, embed URL construction, recorder MIME selection, shared tsconfig presets, utility helpers, web contract schemas, Effect API contract exports, backend video rules, web-domain optional schema decoding, React UI Button rendering, and Solid UI ProgressCircle rendering.
  • Declare package-local Vitest dev dependencies and update the lockfile so filtered package tests do not rely on hoisted binaries.

Review follow-up

  • Storybook coverage now checks plugin identity (solid and unplugin-icons) instead of asserting a fragile raw plugin-array length.
  • packages/ui-solid now has a real src/jest-dom.setup.ts importing @testing-library/jest-dom/vitest, wired through setupFiles, so DOM matcher tests are initialized when needed.

Validation

  • 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 -> 16/16 tasks successful
  • 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-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 applied
  • git diff --check

Prepared with Codex assistance.

@superagent-security superagent-security Bot added contributor:verified Contributor passed trust analysis. pr:verified PR passed security analysis. labels May 19, 2026
Comment thread packages/ui-solid/src/jest-dom.setup.ts Outdated
@@ -0,0 +1 @@
export {};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

Comment thread apps/storybook/storybook-vite.test.ts Outdated
describe("storybook Vite config", () => {
it("loads Solid and Cap UI plugins", () => {
expect(Array.isArray(config.plugins)).toBe(true);
expect(config.plugins).toHaveLength(2);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

Suggested change
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.

@superagent-security superagent-security Bot removed the contributor:verified Contributor passed trust analysis. label May 31, 2026
@partyplatter08-lab
Copy link
Copy Markdown
Author

AI-assisted follow-up on the Greptile findings:

  • apps/storybook/storybook-vite.test.ts now checks plugin identity (solid and unplugin-icons) instead of array length.
  • packages/ui-solid now has a real src/jest-dom.setup.ts importing @testing-library/jest-dom/vitest, wired through setupFiles, so DOM matcher tests are actually initialized when needed.

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 --check

The full filtered test matrix finished with 16/16 tasks successful, and Biome reported Checked 47 files... No fixes applied.

@superagent-security superagent-security Bot removed the pr:verified PR passed security analysis. label May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant