You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 55599fd
Browse filesBrowse the repository at this point in the historyBrowse files
✅ add a Jasmine to Vitest codemod and a migration guard
Groundwork to migrate specs from the Jasmine API to the Vitest API in small
PRs, without blocking other work (unmigrated specs keep running through the
Jasmine compatibility shim).
- scripts/test/jasmine-to-vitest.ts: deterministic codemod (TypeScript AST,
in-place text edits, Prettier) converting spies, spy strategies, calls,
matchers, asymmetric matchers, done callbacks, pending(), fail(), focus/
skip and types; constructs it can't convert safely are reported. On a
conflict, take the file from main and re-run it.
- eslint.config.ts: VITEST_API_SPEC_FILES, where Jasmine globals are
forbidden and test functions must be imported from 'vitest'
- vitest declared as a devDependency of every workspace with specs
- AGENTS.md: write new specs with the Vitest API
- remove the unused mockContextManager helper
Copy file name to clipboardExpand all lines: AGENTS.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,6 +102,7 @@ For deeper context, see:
102
102
103
103
- Test framework: Jasmine API on Vitest Browser Mode (via a shim in `test/unit-vitest/`). Spec files co-located with implementation: `feature.ts` → `feature.spec.ts`
104
104
- Focus tests with `fit()` / `fdescribe()`, skip with `xit()` / `xdescribe()`
105
+
- Specs are being migrated from the Jasmine API to the Vitest API. Write new specs with the Vitest API (`import { describe, expect, it, vi } from 'vitest'`), unless they depend on a test helper that still returns Jasmine spies. Convert existing specs with `node scripts/test/jasmine-to-vitest.ts <files or directories>`, fix what it reports, then add the paths to `VITEST_API_SPEC_FILES` in `eslint.config.ts`
105
106
- Use `registerCleanupTask()` for cleanup, NOT `afterEach()`
106
107
- Prefer `collectAsyncCalls(spy, n)` over `waitFor(() => spy.calls.count() > 0)` for waiting on spy calls
107
108
- Don't destructure methods from `spy.calls` (e.g., `argsFor`, `mostRecent`) - use `calls.argsFor()` to avoid `@typescript-eslint/unbound-method` errors
0 commit comments