test: add package-level Vitest examples for web-cluster and shared packages#1826
test: add package-level Vitest examples for web-cluster and shared packages#1826JYZ-LESLIE wants to merge 2 commits into
Conversation
|
Validation follow-up: all newly added package/app tests pass locally.\n\n- pnpm --filter=@cap/web-cluster test\n- pnpm --filter=@cap/web-api-contract test\n- pnpm --filter=@cap/web-domain test\n- pnpm --filter=@cap/sdk-recorder test\n\nCurrent failing status appears to be the external Vercel authorization gate (team-side authorize-to-deploy), same pattern as other recent PRs. |
| "build": "pnpm run --filter @cap/web-cluster^... build", | ||
| "build:docker": "cd ../.. && docker build -f apps/web-cluster/Dockerfile -t ghcr.io/brendonovich/cap-web-cluster:latest ." | ||
| "build:docker": "cd ../.. && docker build -f apps/web-cluster/Dockerfile -t ghcr.io/brendonovich/cap-web-cluster:latest .", | ||
| "test": "pnpm exec vitest run" |
There was a problem hiding this comment.
vitest missing from devDependencies
pnpm exec vitest run resolves the binary from the local node_modules/.bin. Since vitest is not declared as a devDependency here (or in any of the other three affected packages), the command will fail on a clean install or in CI. It likely passes locally only because vitest is hoisted from another workspace package (e.g. apps/web), which is an implicit, unreliable dependency. The same gap affects packages/sdk-recorder, packages/web-api-contract, and packages/web-domain.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/web-cluster/package.json
Line: 8
Comment:
**`vitest` missing from devDependencies**
`pnpm exec vitest run` resolves the binary from the local `node_modules/.bin`. Since `vitest` is not declared as a `devDependency` here (or in any of the other three affected packages), the command will fail on a clean install or in CI. It likely passes locally only because vitest is hoisted from another workspace package (e.g. `apps/web`), which is an implicit, unreliable dependency. The same gap affects `packages/sdk-recorder`, `packages/web-api-contract`, and `packages/web-domain`.
How can I resolve this? If you propose a fix, please make it concise.| "build": "pnpm run --filter @cap/web-cluster^... build", | ||
| "build:docker": "cd ../.. && docker build -f apps/web-cluster/Dockerfile -t ghcr.io/brendonovich/cap-web-cluster:latest ." | ||
| "build:docker": "cd ../.. && docker build -f apps/web-cluster/Dockerfile -t ghcr.io/brendonovich/cap-web-cluster:latest .", | ||
| "test": "pnpm exec vitest run" |
There was a problem hiding this comment.
No
vitest.config file for the new test suites
None of the four new workspaces ship a vitest.config.ts, while every existing workspace that has a test script (apps/desktop, apps/discord-bot, apps/web) provides one. Without a config, Vitest uses default settings — no TypeScript path-alias resolution, no custom environment, and no globals injection. Adding at least a minimal config file per package aligns with the project's existing pattern.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/web-cluster/package.json
Line: 8
Comment:
**No `vitest.config` file for the new test suites**
None of the four new workspaces ship a `vitest.config.ts`, while every existing workspace that has a `test` script (`apps/desktop`, `apps/discord-bot`, `apps/web`) provides one. Without a config, Vitest uses default settings — no TypeScript path-alias resolution, no custom environment, and no `globals` injection. Adding at least a minimal config file per package aligns with the project's existing pattern.
How can I resolve this? If you propose a fix, please make it concise.|
/claim #54 |
|
Addressed the two Greptile findings in commit 4786679:\n\n- Added explicit |
4786679 to
bb3fbf6
Compare
|
Rebased onto latest Current head: Re-validated after rebase:
All pass locally. |
/claim #54
This PR adds a focused, non-overlapping testing bootstrap slice for issue #54 in additional app/package workspaces beyond the current desktop/utils scope.
What's included
testscripts (pnpm exec vitest run) to:apps/web-clusterpackages/web-api-contractpackages/web-domainpackages/sdk-recorderapps/web-cluster/src/cluster/container-metadata.test.tspackages/web-api-contract/src/desktop.test.tspackages/web-domain/src/utils.test.tspackages/sdk-recorder/src/core/mime-types.test.tsValidation
pnpm --filter=@cap/web-cluster testpnpm --filter=@cap/web-api-contract testpnpm --filter=@cap/web-domain testpnpm --filter=@cap/sdk-recorder testAll four pass locally.
Notes
AI-assisted with Codex; diff reviewed before submission.
Greptile Summary
This PR bootstraps Vitest test coverage in four previously-untested workspaces (
apps/web-cluster,packages/sdk-recorder,packages/web-api-contract,packages/web-domain) by adding atestscript and one representative test file per package.afterEach, and the codec-priority test accurately reflects thePREFERRED_MIME_TYPESiteration order.package.jsonfiles add thetestscript but omitvitestfromdevDependencies, sopnpm exec vitest runwill fail on a clean install or in CI where vitest is not hoisted from another workspace. Novitest.config.tsis provided for any of the new packages, diverging from the pattern established by every other workspace that already has tests.Confidence Score: 3/5
The test logic is correct, but the missing vitest dependency will cause all four new test scripts to fail in CI or on a fresh clone.
The individual test files are well-written and faithfully cover their respective modules, but every package.json in the PR omits vitest from devDependencies. Running pnpm exec vitest run in an isolated package context resolves the binary from that package's own node_modules/.bin — and since vitest is never declared there, the command silently relies on hoisting from another workspace package. This is fragile enough to break turbo run test or any filtered run on a clean CI environment.
All four package.json files need vitest added to devDependencies before the test scripts are reliable.
Important Files Changed
testscript but omitsvitestfrom devDependencies, making the script unreliable outside of environments where vitest is hoisted from another workspacetestscript without addingvitestto devDependencies; same fragile-hoisting issue as web-clusterscriptsblock withtestbut no devDependencies block — vitest is entirely undeclaredtestscript without addingvitestto devDependencies; same fragile-hoisting issue as the other three packagesPrompt To Fix All With AI
Reviews (1): Last reviewed commit: "test: add package-level vitest examples ..." | Re-trigger Greptile