From 4443a9558bfe412aa3827ad88805f67fbdcc1126 Mon Sep 17 00:00:00 2001 From: easonLiangWorldedtech <136036952+easonLiangWorldedtech@users.noreply.github.com> Date: Wed, 28 Oct 2026 01:50:24 +0800 Subject: [PATCH] chore(mutation-gate): use plugin-side related-test discovery for the extension package 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. --- scripts/stryker-diff.mjs | 10 ++++++++-- scripts/stryker-diff.test.mjs | 7 +++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/stryker-diff.mjs b/scripts/stryker-diff.mjs index 9742879106..f0b087d555 100644 --- a/scripts/stryker-diff.mjs +++ b/scripts/stryker-diff.mjs @@ -57,8 +57,14 @@ export const PACKAGE_CONFIGS = [ root: "src", sourceRoot: "src/", vitestConfig: "vitest.config.ts", - vitestRelated: false, - discoverRelatedTests: true, + // Use plugin-side related-test discovery for the extension package: with an + // explicit STRYKER_TEST_FILES list, stryker-js 10.0.0 plans static mutants with + // runtime activation (stryker-mutator/stryker-js#6144, #6209), which the vitest + // plugin can only apply after top-level code has run, producing false Survived + // results. Revert to vitestRelated: false / discoverRelatedTests: true once the + // upstream planner fix lands. + vitestRelated: true, + discoverRelatedTests: false, // CI build/coverage tooling under src/scripts is excluded like the other build scripts: // it is not shipped runtime code and is covered by src/scripts/__tests__/merge-lcov.spec.mjs. excludedPaths: [ diff --git a/scripts/stryker-diff.test.mjs b/scripts/stryker-diff.test.mjs index 22284e598d..5286aba38e 100644 --- a/scripts/stryker-diff.test.mjs +++ b/scripts/stryker-diff.test.mjs @@ -254,8 +254,11 @@ describe("buildManifest", () => { assert.equal(webview.runRoot, ".") assert.equal(webview.discoverRelatedTests, true) assert.equal(webview.vitestRelated, false) - assert.equal(extension.discoverRelatedTests, true) - assert.equal(extension.vitestRelated, false) + // The extension package deliberately uses plugin-side discovery (see the + // comment in PACKAGE_CONFIGS): stryker-js 10.0.0 mis-activates static mutants + // when an explicit STRYKER_TEST_FILES list is supplied. + assert.equal(extension.discoverRelatedTests, false) + assert.equal(extension.vitestRelated, true) const types = manifest.packages.find(({ id }) => id === "types") assert.equal(types.discoverRelatedTests, undefined) assert.equal(types.vitestRelated, undefined)