Pablo Fernandez
@pablo_fernandez • 3 weeks ago
End an agent session with handoff notes a fresh session or teammate can resume from: state, decisions, dead ends, exact failures and next steps.
handoff_pathsession{{handoff_path}}{{session}}handoff_path: docs/handoff/vitest-migration.md
session:
```
- branch chore/vitest-migration, goal: move whole monorepo from Jest to Vitest
- done: packages/utils, packages/api converted. packages/web still on jest
- coverage: tried @vitest/coverage-istanbul, OOM in CI. switched to @vitest/coverage-v8, works locally, not run in CI yet
- replaced jest.mock -> vi.mock. 3 tests in api used jest.requireActual -> vi.importActual (it's async, made mock factories async)
- tried vitest.workspace.ts -> deprecation warning, used test.projects in root vitest.config.ts instead
- web uses jsdom + testing-library, setupTests.ts imports '@testing-library/jest-dom' -> needs '@testing-library/jest-dom/vitest'
- pnpm --filter api test:
FAIL src/routes/orders.test.ts > creates order
TypeError: vi.mocked(...).mockResolvedValue is not a function
FAIL src/lib/time.test.ts > formats IST date
AssertionError: expected '24 Sept 2026' to be '24 Sep 2026'
- haven't touched .github/workflows/test.yml
```packages/utils convertedpackages/api converted (2 failing tests, see section 5)packages/web: still on Jest, not started.github/workflows/test.yml: not updated@vitest/coverage-v8: works locally; unverified in CI@vitest/coverage-v8. coverage-istanbul ran out of memory in CI.test.projects in the root vitest.config.ts, not a vitest.workspace.ts file, which gave a deprecation warning.jest.requireActual became vi.importActual. It's async, so the three affected mock factories in packages/api are now async.vitest.workspace.ts: deprecated, so don't reintroduce it.@vitest/coverage-istanbul: OOM in CI.pnpm --filter api test)``orders.test.ts: this error usually means the module isn't actually mocked, so vi.mocked returns the real function. Check that the vi.mock() path matches the import path exactly.time.test.ts: 'Sept' vs 'Sep' is Intl output for the en-GB locale, which varies with the ICU data in the Node build. Check whether Jest ran on a different Node version, or assert on a locale-independent format.src/routes/orders.test.ts: compare the vi.mock() specifier with the import in src/routes/orders.ts.src/lib/time.test.ts once the Node/ICU question is answered.packages/web: in setupTests.ts, change the import to @testing-library/jest-dom/vitest, set environment: "jsdom" for the web project, and run it.`bash`git log and a fresh test run before trusting them. Don't commit notes that contain secrets or customer data from logs.