Skip to content

refactor(js): decouple vitest/jest runner from CLI Commands enum - #2418

Merged
KuSh merged 3 commits into
developfrom
refacto/vitest-decouple
Oct 3, 2026
Merged

KuSh merged 3 commits into
developfrom
refacto/vitest-decouple

Conversation

@aeppling

Copy link
Copy Markdown
Contributor

run_test(&Commands) : run_vitest/run_jest over a shared helper, fix tracking encode and doc

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.
@HenriqueSchroeder

Copy link
Copy Markdown
Contributor

Heads up: #1374 (Bun support) carries the same decoupling of run_test from the Commands enum, shaped as run_test(TestFramework, ...) instead of run_vitest/run_jest with a &str framework. It is not optional there, the bunx and bun run routing reaches vitest_cmd from outside the Commands enum.

Whichever lands first, the other needs a rebase on that file.

KuSh and others added 2 commits October 3, 2026 17:20
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 KuSh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 … loses run: the skip list drops a literal run anywhere in the arguments. Pre-existing; #3777's rewrite keeps the same clause.
  • #4432 Dispatch arm and spawn wiring of rtk vitest / rtk jest untested (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 adds jest.

Checked and correct — no need to re-verify

  • … in the join_with_overflow example is what utils.rs emits; ignore is on the one TimedExecution example that calls helpers which do not exist. rtk has no lib target, so neither block is compiled.
  • main.rs is the only caller; pipe_cmd.rs uses VitestParser only, and bun/deno/npx/pnpm have no route into vitest_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.

@KuSh
KuSh merged commit c7707f5 into develop Oct 3, 2026
17 checks passed
@rtk-release-bot rtk-release-bot Bot mentioned this pull request Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants