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
vitest.mutate.config.ts's testNamePattern overrides Stryker's per-mutant test filter, so each mutant runs every test of its files #1953
vitest.mutate.config.ts:13 sets testNamePattern to leave out the clock-face test. Vitest 5.1.0 copies a config's testNamePattern into vitest.configOverride at start (node_modules/vitest/dist/chunks/cli-api.COfZo8lK.js:12984), and every project's serialized config is merged under that override (node_modules/vitest/dist/chunks/index.Di8au7q4.js:6762-6766).
On a mutant run, @stryker-mutator/vitest-runner 10.1.1 narrows the tests by writing project.config.testNamePattern = <regex of the covering test ids> (dist/src/vitest-test-runner.js:212-215). The override wins, so that regex is ignored: each mutant runs every test in the covering files except the clock-face one, not just the tests that cover it. Results stay right, but runs are slower.
What I saw: I created Vitest in-process the way the runner does (createVitest("test", { config: "vitest.mutate.config.ts", pool: "threads", maxWorkers: 1 })), set every project's testNamePattern to /is the workerId its payload names\s*$/, and ran ui/src/model/events.test.ts:
with vitest.mutate.config.ts: 12 run, 1 skipped (the clock-face test)
same config with the testNamePattern removed: 1 run (the named test), 12 skipped
So once the clock-face test stops depending on process.env.TZ (or is skipped in some other way), the config's testNamePattern can go and Stryker's filter will work again.
Seen on: fakes (Vitest 5.1.0 created in-process the way @stryker-mutator/vitest-runner 10.1.1 does; Stryker itself not run)
Confirmed as reported. src/mutate-config.test.ts, "runs only the two tests a mutant's filter names, and its dry run fails none of the file's tests", on bug/1953-repro. It reads stryker.config.mjs for the config file and pool (threads by default), writes a two-name filter on every project as the runner does, and runs ui/src/model/events.test.ts. The second half runs the dry run (filter undefined), so a fix that only drops the pattern fails too.
$ pnpm exec vitest run --project unit src/mutate-config.test.ts
AssertionError: expected [ …(12) ] to deeply equal [ …(2) ]
All 12 non-clock-face tests ran instead of the two named ones.
Root cause
Defect. vitest.mutate.config.ts:13 sets testNamePattern. Vitest copies it into configOverride (vitest/dist/chunks/cli-api.COfZo8lK.js:12984), and that is merged over every project's config (index.Di8au7q4.js:6762-6766). So the runner's per-mutant project.config.testNamePattern = regex (vitest-test-runner.js:212-215) never takes effect. The pattern is there only because Stryker's default threads pool ignores the clock-face test's process.env.TZ.
Simplest fix
Delete the testNamePattern line and its comment from vitest.mutate.config.ts. In stryker.config.mjs, set vitest: { configFile: "vitest.mutate.config.ts", pool: "forks" } with a why comment: a forked process honours TZ, so the clock-face test passes there.
$ pnpm exec vitest run --project unit src/mutate-config.test.ts src/mutate.test.ts src/test-lanes.repo.test.ts ui/src/model/events.test.ts
Test Files 4 passed (4)
Tests 41 passed (41)
Dropping the pattern alone fails the dry-run half: expected [ 'failed' ] to deeply equal [].
Alternatives rejected
it.skipIf(!isMainThread) on the clock-face test: the test lint refuses a skipIf that is not on process.platform or a SIMLOCK_ variable (testing rule 5).
Rewrite the clock-face test so it does not need TZ: a larger change to a console test, for the same result.
Risk
Not run under real Stryker (agents may not run pnpm mutate). The first harden-tests run proves the forks pool and perTest coverage work together.
Forks start slower than threads for each test file. That cost should be far below running every test of a file for each mutant.
Activity
V3RON commentedon Nov 29, 2026
Reproduction
Seen on: fakes (Vitest 5.1.0 created in-process the way
@stryker-mutator/vitest-runner10.1.1 does; Stryker itself not run)Confirmed as reported.
src/mutate-config.test.ts, "runs only the two tests a mutant's filter names, and its dry run fails none of the file's tests", onbug/1953-repro. It readsstryker.config.mjsfor the config file and pool (threadsby default), writes a two-name filter on every project as the runner does, and runsui/src/model/events.test.ts. The second half runs the dry run (filterundefined), so a fix that only drops the pattern fails too.All 12 non-clock-face tests ran instead of the two named ones.
Root cause
Defect.
vitest.mutate.config.ts:13setstestNamePattern. Vitest copies it intoconfigOverride(vitest/dist/chunks/cli-api.COfZo8lK.js:12984), and that is merged over every project's config (index.Di8au7q4.js:6762-6766). So the runner's per-mutantproject.config.testNamePattern = regex(vitest-test-runner.js:212-215) never takes effect. The pattern is there only because Stryker's defaultthreadspool ignores the clock-face test'sprocess.env.TZ.Simplest fix
Delete the
testNamePatternline and its comment fromvitest.mutate.config.ts. Instryker.config.mjs, setvitest: { configFile: "vitest.mutate.config.ts", pool: "forks" }with a why comment: a forked process honoursTZ, so the clock-face test passes there.Dropping the pattern alone fails the dry-run half:
expected [ 'failed' ] to deeply equal [].Alternatives rejected
it.skipIf(!isMainThread)on the clock-face test: the test lint refuses askipIfthat is not onprocess.platformor aSIMLOCK_variable (testing rule 5).TZ: a larger change to a console test, for the same result.Risk
pnpm mutate). The firstharden-testsrun proves the forks pool andperTestcoverage work together.Fast track
Written by an agent.
fix(mutate): Stryker runs vitest in forks so the clock-face test keep…
V3RON commentedon Nov 29, 2026
Delivery run
Merged: #1954 (#1953)
Parked: none
Waiting: none
Decided: none
Written by an agent.