CS-10346: vitest migration scaffolding + first leaf test#4841
Draft
lukemelia wants to merge 2 commits into
Draft
CS-10346: vitest migration scaffolding + first leaf test#4841lukemelia wants to merge 2 commits into
lukemelia wants to merge 2 commits into
Conversation
Recovers Ian's QUnit→Vitest codemod (995 lines, AST-based via the TypeScript compiler API) from the 9-months-stale branch and rewires it against current realm-server tests: - Codemod writes `tests-vitest/` as a parallel tree of `.test.ts` files; the QUnit suite under `tests/` is untouched. Running the codemod transforms 111 tests + copies 77 support files; one file (card-reference-resolver-test.ts) flags 11 `assert.throws(..., /regex/, ...)` calls for manual follow-up. - `tests-vitest/.gitignore` allowlists files only as they graduate to vitest, so the auto-generated tree stays out of git. - `vitest.config.ts` runs singleThread to match QUnit's serial model while parallelism is deferred to a later phase. - `async-semaphore.test.ts` is the first graduate: 18/18 passing in 3ms via `pnpm run test:vitest`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Adds a `realm-server-vitest-test` job gated on the same path filter as the main realm-server-test matrix. Currently runs the single async-semaphore test (18 assertions, ~100ms) — the harness is the point, not the coverage. As more files graduate, the job picks them up via vitest.config.ts include[]. - Documents in vitest.config.ts why other leaf candidates can't graduate yet: vite eager-walks @cardstack/runtime-common's TS source graph and can't resolve transitive pnpm-hoisted deps (acorn, magic-string) that aren't direct deps of realm-server. server.deps.external / ssr.external don't intercept the transform path. Stage 1.b will resolve this; until then only tests that don't import runtime-common can move. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Host Test Results 1 files 1 suites 1h 37m 56s ⏱️ Results for commit c193b2d. Realm Server Test Results 1 files ± 0 1 suites +1 9m 29s ⏱️ + 9m 29s Results for commit c193b2d. ± Comparison against earlier commit 61d3eb3. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Foundational PoC for migrating the realm-server test harness from QUnit to Vitest (CS-10346). Recovers Ian's AST-based codemod from his stale March branch, rewires it against current
tests/, and graduates one leaf test as proof the loop works end-to-end.This is stage 1 scaffolding, not the actual migration. Strictly additive: the QUnit suite is untouched and remains the load-bearing test runner.
What's here
scripts/codemods/qunit-to-vitest.ts— Ian's AST codemod (995 lines, TypeScript compiler API). Run viapnpm codemod:qunit-to-vitest. On the currenttests/tree it transforms 111 test files + copies 77 support files; only one file (card-reference-resolver-test.ts) flags unsupported asserts (11xassert.throws(..., /regex/, ...)to translate by hand).tests-vitest/— parallel codemod output tree..gitignoreallowlists files only as they graduate to vitest, so the auto-generated tree stays out of git.vitest.config.ts— minimal config,singleThread: true(parallelism deferred to a separate ticket).tests-vitest/async-semaphore.test.ts— first graduate.pnpm test:vitest→ 18/18 passing in 3ms.Migration plan (this PR = stage 1.a)
helpers/), wire CI to runtest:vitest. (Continues on this branch — TODO before un-draft.)helpers/+@cardstack/realm-test-harnessto be harness-agnostic. This is where Ian's "some still failing" tests live.tests/index.tsregistry, signal handlers, undici teardown,qunitdep). Movetests-vitest/→tests/.Graduation workflow
Each file that goes vitest:
pnpm codemod:qunit-to-vitest.tests-vitest/.gitignoreallowlist.vitest.config.tsinclude[].pnpm test:vitestand fix anything the codemod didn't translate.Test plan
pnpm -F @cardstack/realm-server test:vitestpasses locally (18/18, ~100ms).🤖 Generated with Claude Code