fix(test): vitest 4 projects + src/web jsdom env #59

Merged
michal merged 1 commits from fix/vitest-workspace-projects into main 2026-04-26 20:31:50 +00:00
Owner

Summary

Fixes `pnpm test:run` (workspace-level) which broke after the personality
PR landed. The new src/web tests need jsdom for `localStorage`, but vitest 4
quietly stopped honoring `vitest.workspace.ts` so per-package configs
weren't being picked up — every project ran under the root config's Node env.

  • Move workspace project list into the root `vitest.config.ts` under the new
    `projects` field (vitest 4's replacement for `vitest.workspace.ts`).
  • Add `src/web/vitest.config.ts` so the workspace runner picks up the
    jsdom env and test include glob.
  • Exclude `src/web/tests/**` from the root config's include to avoid
    double-discovery under the wrong env.

After: 1999/1999 across 149 test files (was 1992/1996 with 4 src/web failures).

🤖 Generated with Claude Code

## Summary Fixes \`pnpm test:run\` (workspace-level) which broke after the personality PR landed. The new src/web tests need jsdom for \`localStorage\`, but vitest 4 quietly stopped honoring \`vitest.workspace.ts\` so per-package configs weren't being picked up — every project ran under the root config's Node env. - Move workspace project list into the root \`vitest.config.ts\` under the new \`projects\` field (vitest 4's replacement for \`vitest.workspace.ts\`). - Add \`src/web/vitest.config.ts\` so the workspace runner picks up the jsdom env and test include glob. - Exclude \`src/web/tests/**\` from the root config's include to avoid double-discovery under the wrong env. After: 1999/1999 across 149 test files (was 1992/1996 with 4 src/web failures). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
michal added 1 commit 2026-04-26 20:31:39 +00:00
fix(test): switch workspace runner to vitest 4 \projects\ field
Some checks failed
CI/CD / typecheck (pull_request) Successful in 57s
CI/CD / test (pull_request) Successful in 1m7s
CI/CD / lint (pull_request) Successful in 2m43s
CI/CD / smoke (pull_request) Failing after 1m45s
CI/CD / build (pull_request) Successful in 5m43s
CI/CD / publish (pull_request) Has been skipped
bf0a60bc0a
The workspace-level \`pnpm test:run\` (which fulldeploy.sh runs as a
gate) was failing with \`localStorage is not defined\` on the new
src/web tests. Two intertwined causes:

1. vitest 4 deprecated \`vitest.workspace.ts\`. The file was being
   silently ignored, so per-package configs (cli, mcpd, mcplocal)
   weren't being honored under workspace mode either — the root
   config was being used for all of them.

2. With the root config in charge, src/web/tests ran with the default
   Node environment, no \`localStorage\` global, so the api wrapper's
   test setup blew up.

Fix:
- Move workspace projects into the root \`vitest.config.ts\` under the
  new \`projects\` array (the vitest 4 replacement).
- Add a proper \`src/web/vitest.config.ts\` (vitest 4 doesn't auto-pick
  up vite.config.ts as a test config in workspace mode, even though
  per-package \`pnpm --filter\` does).
- Exclude \`src/web/tests/**\` from the root-level include so we don't
  double-run them under the wrong env.

After: \`pnpm test:run\` runs 1999/1999 across 149 files (was 1992/1996
with 4 web failures). Per-package runs unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
michal merged commit 899f2c750c into main 2026-04-26 20:31:50 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: michal/mcpctl#59