Skip to content

Commit 43d8d85

Browse files
easonLiangWorldedtechedelauna
authored andcommitted
chore(mutation-gate): use plugin-side related-test discovery for the extension package (#2211)
stryker-js 10.0.0 mis-activates static mutants when an explicit STRYKER_TEST_FILES list is supplied (stryker-mutator/stryker-js#6144, #6209), producing false Survived results. Use the vitest plugin related-test discovery for the extension package and update the manifest expectation. Extracted from #1522 per review so it can be reverted when the upstream fix lands. stryker-diff tests 44 passed.
1 parent bc72f33 commit 43d8d85

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

‎scripts/stryker-diff.mjs‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,14 @@ export const PACKAGE_CONFIGS = [
5757
root: "src",
5858
sourceRoot: "src/",
5959
vitestConfig: "vitest.config.ts",
60-
vitestRelated: false,
61-
discoverRelatedTests: true,
60+
// Use plugin-side related-test discovery for the extension package: with an
61+
// explicit STRYKER_TEST_FILES list, stryker-js 10.0.0 plans static mutants with
62+
// runtime activation (stryker-mutator/stryker-js#6144, #6209), which the vitest
63+
// plugin can only apply after top-level code has run, producing false Survived
64+
// results. Revert to vitestRelated: false / discoverRelatedTests: true once the
65+
// upstream planner fix lands.
66+
vitestRelated: true,
67+
discoverRelatedTests: false,
6268
// CI build/coverage tooling under src/scripts is excluded like the other build scripts:
6369
// it is not shipped runtime code and is covered by src/scripts/__tests__/merge-lcov.spec.mjs.
6470
excludedPaths: [

‎scripts/stryker-diff.test.mjs‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,11 @@ describe("buildManifest", () => {
254254
assert.equal(webview.runRoot, ".")
255255
assert.equal(webview.discoverRelatedTests, true)
256256
assert.equal(webview.vitestRelated, false)
257-
assert.equal(extension.discoverRelatedTests, true)
258-
assert.equal(extension.vitestRelated, false)
257+
// The extension package deliberately uses plugin-side discovery (see the
258+
// comment in PACKAGE_CONFIGS): stryker-js 10.0.0 mis-activates static mutants
259+
// when an explicit STRYKER_TEST_FILES list is supplied.
260+
assert.equal(extension.discoverRelatedTests, false)
261+
assert.equal(extension.vitestRelated, true)
259262
const types = manifest.packages.find(({ id }) => id === "types")
260263
assert.equal(types.discoverRelatedTests, undefined)
261264
assert.equal(types.vitestRelated, undefined)

0 commit comments

Comments
 (0)