test: add package-level Vitest examples#1818
Conversation
| import { describe, expect, it } from "vitest"; | ||
| import { | ||
| calculateStrokeDashoffset, | ||
| classNames, | ||
| getDisplayProgress, | ||
| getProgressCircleConfig, | ||
| isEmailAllowedByRestriction, | ||
| uuidFormat, | ||
| uuidParse, |
There was a problem hiding this comment.
Missing
vitest.config.ts across new packages
None of the four new packages (@cap/utils, @cap/sdk-embed, @cap/sdk-recorder, @cap/web-domain) ship a vitest.config.ts. Vitest will fall back to its built-in defaults, which works here because all test imports use relative paths and no DOM environment is required. However, without an explicit config the tsconfig path aliases (if any are added later) won't be resolved, and the test environment can't be pinned — making the setup fragile as coverage grows. The existing apps/desktop/vitest.config.ts is a handy reference for what a minimal config looks like.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/utils/src/helpers.test.ts
Line: 1-9
Comment:
**Missing `vitest.config.ts` across new packages**
None of the four new packages (`@cap/utils`, `@cap/sdk-embed`, `@cap/sdk-recorder`, `@cap/web-domain`) ship a `vitest.config.ts`. Vitest will fall back to its built-in defaults, which works here because all test imports use relative paths and no DOM environment is required. However, without an explicit config the `tsconfig` path aliases (if any are added later) won't be resolved, and the test environment can't be pinned — making the setup fragile as coverage grows. The existing `apps/desktop/vitest.config.ts` is a handy reference for what a minimal config looks like.
How can I resolve this? If you propose a fix, please make it concise.|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
Summary
testscripts and first example suites for@cap/sdk-embed,@cap/sdk-recorder,@cap/web-domain, and@cap/web-api-contractvitest.config.tsfiles so the new suites pin the node environment, include pattern, and dist/node_modules exclusions/claim #54
This is a focused package-level test coverage pass for the packages touched by issue #54, with package-local Vitest configuration and minimal lockfile changes.
Dependency/security triage: the current diff only adds
vitestas a package-local devDependency for the new test scripts. The Socket-listed runtime dependencies from the earlier wider diff are not part of the current package.json diff, andentities@4.5.0already existed in the base lockfile (not introduced here). The lockfile update for@cap/web-api-contractis limited to its importer entry.Verification
pnpm install --frozen-lockfile --lockfile-onlypnpm --filter @cap/web-api-contract testpnpm --filter @cap/web-api-contract exec tsc --noEmit --target ES2020 --module ESNext --moduleResolution bundler --skipLibCheck --strict --types vitest --lib ES2020,DOM src/index.ts src/desktop.ts src/index.test.tspnpm turbo run test --filter=@cap/sdk-embed --filter=@cap/sdk-recorder --filter=@cap/web-domain --filter=@cap/web-api-contractpnpm --filter @cap/sdk-embed typecheckpnpm --filter @cap/sdk-recorder typecheckpnpm --filter @cap/web-domain exec tsc --noEmitpnpm exec biome check packages/sdk-embed/package.json packages/sdk-embed/src/vanilla/cap-embed.test.ts packages/sdk-embed/vitest.config.ts packages/sdk-recorder/package.json packages/sdk-recorder/src/core/mime-types.test.ts packages/sdk-recorder/src/index.ts packages/sdk-recorder/vitest.config.ts packages/web-domain/package.json packages/web-domain/src/Policy.test.ts packages/web-domain/vitest.config.ts packages/web-api-contract/package.json packages/web-api-contract/src/index.test.ts packages/web-api-contract/vitest.config.tsgit diff --check