Skip to content

Commit 04fca00

Browse files
committed
test(mutation): configure mutation testing with vitest integration
- Add vitest-runner plugin to stryker configuration - Create custom vitest.mutation.config.ts to exclude slow tests - Set coverageAnalysis to 'off' for faster mutation testing - Remove incompatible typescript checker configuration - Configure to run only validation tests (exclude *.exp.*.test.ts) - Set 60s timeout for mutation test execution - Update concurrency setting from maxConcurrentTestRunners This enables mutation testing to run successfully on test infrastructure, validating test effectiveness by injecting code mutations and verifying tests fail appropriately.
1 parent e5337de commit 04fca00

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

stryker.config.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
{
22
"$schema": "./node_modules/@stryker-mutator/core/schema/stryker-schema.json",
33
"packageManager": "pnpm",
4+
"plugins": [
5+
"@stryker-mutator/vitest-runner"
6+
],
47
"testRunner": "vitest",
5-
"coverageAnalysis": "perTest",
8+
"vitest": {
9+
"configFile": "vitest.mutation.config.ts"
10+
},
11+
"coverageAnalysis": "off",
612
"mutate": [
713
"src/experiments/evaluation/__tests__/validation/common/benchmark-graph-expander.ts",
814
"src/experiments/evaluation/__tests__/validation/common/test-graph-expander.ts",
@@ -12,7 +18,6 @@
1218
"src/experiments/evaluation/metrics/structural-representativeness.ts"
1319
],
1420
"mutator": {
15-
"plugins": ["@stryker-mutator/typescript-checker"],
1621
"excludedMutations": [
1722
"StringLiteral",
1823
"BlockStatement"
@@ -33,8 +38,7 @@
3338
},
3439
"timeoutMS": 300000,
3540
"timeoutFactor": 1.5,
36-
"maxConcurrentTestRunners": 2,
41+
"concurrency": 2,
3742
"disableTypeChecks": "{test,src,lib}/**/*.{js,ts,jsx,tsx,html,vue}",
38-
"checkers": ["typescript"],
3943
"tsconfigFile": "tsconfig.json"
4044
}

vitest.mutation.config.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { defineConfig } from "vitest/config";
2+
import tsconfigPaths from "vite-tsconfig-paths";
3+
4+
export default defineConfig({
5+
plugins: [tsconfigPaths()],
6+
test: {
7+
globals: true,
8+
environment: "node",
9+
fileParallelism: false,
10+
testTimeout: 60000, // 60 seconds for mutation testing
11+
include: [
12+
"src/experiments/evaluation/__tests__/validation/common/*.unit.test.ts",
13+
"src/experiments/evaluation/__tests__/validation/*.unit.test.ts",
14+
"src/experiments/evaluation/metrics/*.property.unit.test.ts",
15+
],
16+
exclude: [
17+
"node_modules",
18+
"dist",
19+
"**/*.exp.*.test.ts", // Exclude expensive experimental tests
20+
"**/*.integration.test.ts", // Exclude slow integration tests except validation
21+
],
22+
},
23+
});

0 commit comments

Comments
 (0)