Commit 9d31a34
committed
Migrate test runner from ts-jest to Vitest
Closes #629.
Switches the test pipeline from `ts-jest`/Jest to Vitest so the test
toolchain aligns with the esbuild-based production build, drops the
`TS5107` workaround we needed in `tsconfig.test.json`, and unblocks the
TypeScript 7 upgrade (which removes `node10` resolution).
- Replace `ts-jest`, `jest`, `jest-environment-jsdom`, `@types/jest`
with `vitest`, `@vitest/coverage-v8`, `@vitest/ui`, and `jsdom`.
- Add `vitest.config.ts` with jsdom env, path/module aliases that mirror
the old `moduleNameMapper`, and a small Vite plugin that loads
`.hbs`/`.md`/`.txt` as raw text (replacement for
`text-transformer.mjs`).
- Rewrite `test/**` and `__mocks__/**` from `jest.fn`/`jest.mock`/
`jest.requireActual`/etc. to their `vi` equivalents. Constructor mocks
use `function`/class syntax so vitest 4.x can call them with `new`.
- Convert mock modules in `__mocks__/` to ESM and import `vi` from
`vitest`.
- Use `vi.hoisted()` in `mcp-manager.test.ts` for uppercase mock
identifiers vitest's auto-hoist heuristic doesn't recognize.
- Replace `require('../models')` in `src/services/model-manager.ts`
with `import * as modelsModule from '../models'` (live binding) so
the file works under Vite's ESM loader without changing behavior.
- Update tsconfig.test.json: `types: ['vitest/globals', 'node']` and
drop `ignoreDeprecations: '6.0'`.
- `npm test` now runs `vitest run`; `npm run test:watch` runs the
watcher. CI's existing `npm test -- --coverage` keeps working
because vitest accepts `--coverage`.
Docs: AGENTS.md and docs/contributing/tool-development.md now reference
Vitest/`vi.fn()`.
https://claude.ai/code/session_016L3CBfrG11AHHTRegiW89N1 parent b792af6 commit 9d31a34
70 files changed
Lines changed: 2910 additions & 5121 deletions
File tree
- __mocks__
- @google
- docs/contributing
- src/services
- test
- __mocks__/@modelcontextprotocol/sdk/client
- agent
- api
- utils
- mcp
- prompts
- services
- tools
- ui
- agent-view
- utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | | - | |
211 | | - | |
212 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | | - | |
20 | | - | |
21 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
22 | 25 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 26 | + | |
| 27 | + | |
0 commit comments