Skip to content

test: add package-level Vitest examples#1818

Open
NeurArk wants to merge 4 commits into
CapSoftware:mainfrom
NeurArk:test/issue-54-monorepo-bootstrap
Open

test: add package-level Vitest examples#1818
NeurArk wants to merge 4 commits into
CapSoftware:mainfrom
NeurArk:test/issue-54-monorepo-bootstrap

Conversation

@NeurArk
Copy link
Copy Markdown

@NeurArk NeurArk commented May 14, 2026

Summary

  • add Vitest test scripts and first example suites for @cap/sdk-embed, @cap/sdk-recorder, @cap/web-domain, and @cap/web-api-contract
  • add minimal package-local vitest.config.ts files so the new suites pin the node environment, include pattern, and dist/node_modules exclusions
  • cover SDK embed URL construction, recorder MIME selection, web-domain public policy composition, and web API contract schema/route stability
  • fix the sdk-recorder event-listener cleanup cast uncovered while running its package typecheck

/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 vitest as 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, and entities@4.5.0 already existed in the base lockfile (not introduced here). The lockfile update for @cap/web-api-contract is limited to its importer entry.

Verification

  • pnpm install --frozen-lockfile --lockfile-only
  • pnpm --filter @cap/web-api-contract test
  • pnpm --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.ts
  • pnpm turbo run test --filter=@cap/sdk-embed --filter=@cap/sdk-recorder --filter=@cap/web-domain --filter=@cap/web-api-contract
  • pnpm --filter @cap/sdk-embed typecheck
  • pnpm --filter @cap/sdk-recorder typecheck
  • pnpm --filter @cap/web-domain exec tsc --noEmit
  • pnpm 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.ts
  • git diff --check

@superagent-security superagent-security Bot added contributor:verified Contributor passed trust analysis. pr:verified PR passed security analysis. labels May 14, 2026
Comment thread packages/utils/src/helpers.test.ts Outdated
Comment on lines +1 to +9
import { describe, expect, it } from "vitest";
import {
calculateStrokeDashoffset,
classNames,
getDisplayProgress,
getProgressCircleConfig,
isEmailAllowedByRestriction,
uuidFormat,
uuidParse,
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 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.

@NeurArk NeurArk changed the title test: bootstrap monorepo Vitest coverage test: add package-level Vitest examples May 14, 2026
@socket-security
Copy link
Copy Markdown

socket-security Bot commented May 14, 2026

No dependency changes detected. Learn more about Socket for GitHub.

👍 No dependency changes detected in pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🙋 Bounty claim contributor:verified Contributor passed trust analysis. pr:verified PR passed security analysis.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant