Repository navigation
refactor(js): decouple vitest/jest runner from CLI Commands enum - #2418
Conversation
run_test(&Commands) → run_vitest/run_jest over a shared helper, dropping the module dependency on the CLI Commands enum and the unreachable!() arm. Also fix two doctests that surface once the crate is bundled as a lib: correct join_with_overflow (Unicode ellipsis) and mark the TimedExecution example ignore.
|
Heads up: #1374 (Bun support) carries the same decoupling of Whichever lands first, the other needs a rebase on that file. |
develop now builds vitest arguments with build_vitest_effective_args and applies the reporter/watch skip loop to jest only, so run_vitest passes the explicit-reporter passthrough flag and run_jest owns the skip loop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…test and jest spawn rtk jest was missing from is_operational_command, so a tampered legacy hook that stops rtk vitest let rtk jest run. run_vitest and run_jest now build a TestInvocation (framework, arguments, passthrough) that run_framework_test executes, so tests can assert the tool each one runs, its arguments and whether reporter output passes through. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KuSh
left a comment
There was a problem hiding this comment.
Round 1 of 3 — APPROVED, follow-ups filed
Claim: vitest_cmd::run_test(&Commands, …) becomes run_vitest / run_jest over a shared run_framework_test with no behaviour change, plus two doc-only fixes (join_with_overflow example, one TimedExecution example marked ignore).
Scope: accept (round 1, frozen). Lands before #3777 and #3680: their run_test hunks move into jest_invocation / run_vitest.
Ran: real vitest 3.2 and jest 30 projects × 18–22 commands (failing, green, zero-match, explicit reporter in both spellings, --watch, --json, npx form, --help, tool missing), merge-base vs this head, then develop vs this head merged onto develop, then develop vs the fixup, each through rtk rewrite first. Exit codes, stdout, stderr, tracking rows and tee files are identical apart from timings. A tampered legacy hook now stops rtk jest as it stops rtk vitest. Invariants: under the hook, split streams, every decision. Savings on the failing run: vitest 36%, jest 55%, vs the 20% floor (CONTRIBUTING.md).
Pins: 17 decisions, 17 mutated, 3 survived. On this head all 13 moved decisions survived, as they do on develop; the fixup adds tests that kill 14 of the 17. Survivors: the run_cli dispatch arm and the two places run_framework_test hands the invocation to the process, filed as #4432.
Matrix: executed this round; pin check: executed this round
CI @58d25021e: all green (17/17)
Blocks merge (0)
Filed as follow-ups
- #4431
rtk jest -t run …losesrun: the skip list drops a literalrunanywhere in the arguments. Pre-existing; #3777's rewrite keeps the same clause. - #4432 Dispatch arm and spawn wiring of
rtk vitest/rtk jestuntested (the 3 surviving mutations). - #4433 Seven other hook-rewritten commands skip the hook integrity check (
aws,psql,wc,mypy,gradlew,mvn,mvnd). Pre-existing; this PR addsjest.
Checked and correct — no need to re-verify
…in thejoin_with_overflowexample is whatutils.rsemits;ignoreis on the oneTimedExecutionexample that calls helpers which do not exist. rtk has no lib target, so neither block is compiled.main.rsis the only caller;pipe_cmd.rsusesVitestParseronly, and bun/deno/npx/pnpm have no route intovitest_cmd.
Your questions
None.
Next
Fixup pushed, two commits, code-reviewed: 475140e merges develop, which rewrote the vitest arm since June (explicit --reporter passthrough, skip loop for jest only); 58d2502 builds a TestInvocation (vitest_invocation replaces build_vitest_effective_args) that run_framework_test executes, with tests pinning what each runner spawns, and adds jest to the hook integrity check. Approving.
Rounds: 1/3. Threads: 0 open.
run_test(&Commands) : run_vitest/run_jest over a shared helper, fix tracking encode and doc