3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-20 07:05:44 +01:00

Answer product-owner round 1: 0 🔴, 1 🟡 (0 misread); the README names the memory a mutation run needs, and a RuntimeError lists its mutants and the likely cause

This commit is contained in:
2026-10-28 20:21:29 +01:00
parent 2786252a7c
commit 1400cb97b3
7 changed files with 32 additions and 25 deletions
+6 -4
View File
@@ -1,9 +1,11 @@
import { readFileSync } from 'node:fs'
import config from './stryker.config.mjs'
const mutants = Object.values(JSON.parse(readFileSync(config.jsonReporter.fileName, 'utf8')).files).flatMap((file) => file.mutants)
const errors = mutants.filter((mutant) => mutant.status === 'RuntimeError').length
if (errors > 0) {
console.error(`${errors} of ${mutants.length} mutants ended as RuntimeError, so each may hide a survivor`)
const files = Object.entries(JSON.parse(readFileSync(config.jsonReporter.fileName, 'utf8')).files)
const mutants = files.flatMap(([path, file]) => file.mutants.map((mutant) => ({ ...mutant, path })))
const errors = mutants.filter((mutant) => mutant.status === 'RuntimeError')
if (errors.length > 0) {
console.error(`${errors.length} of ${mutants.length} mutants ended as RuntimeError, so each may hide a survivor. A test run killed for lack of memory ends so:`)
for (const mutant of errors) console.error(` ${mutant.path}:${mutant.location.start.line} ${mutant.mutatorName}`)
process.exit(1)
}
+2 -2
View File
@@ -5,7 +5,7 @@ source ./docker-runner.sh
base=$(git merge-base "${1:-origin/main}" HEAD)
# Each hunk's added lines as path:first-last, in the working tree's numbering; a hunk that only deletes has none to mutate.
mutate=$(git diff --no-ext-diff --no-prefix -U0 --no-color "$base" -- 'src/*.ts' ':!src/*.test.ts' ':!src/conformance/property-harness.ts' | awk '
mutate=$(git diff --no-ext-diff --no-prefix -U0 --inter-hunk-context=0 --no-color "$base" -- 'src/*.ts' ':!src/*.test.ts' ':!src/conformance/property-harness.ts' | awk '
/^\+\+\+ / { path = $2 }
/^@@ / {
split($3, added, ",")
@@ -19,5 +19,5 @@ if [ -z "$mutate" ]; then
fi
leg "install ($node_image)" in_image "$node_image" sh -c 'npm ci --no-audit --no-fund && npm ci --no-audit --no-fund --prefix mutation-tests'
# A test file peaks near 2.6 GB: past four workers 6 GB kills some, and a killed worker's mutant reads as a RuntimeError, which fails the run.
# Four workers fit 6 GB in measured runs where fifteen had some killed, and a killed worker's mutant reads as a RuntimeError, which fails the run.
in_image_memory=6g leg "mutation tests ($node_image)" in_image "$node_image" sh -c 'mutation-tests/node_modules/.bin/stryker run mutation-tests/stryker.config.mjs --concurrency 4 --mutate "$1" && node mutation-tests/check-runtime-errors.mjs' sh "$mutate"
+1 -1
View File
@@ -6,6 +6,6 @@ export default {
tap: { testFiles: ['src/**/*.test.ts'] },
tempDirName: '/tmp/stryker',
testRunner: 'tap',
// TypeScript 7 has no JavaScript API for Stryker's tsconfig rewrite to call; a file that is not there skips it.
// Stryker skips its tsconfig rewrite, which calls a JavaScript API TypeScript 7 lacks, when this file is missing.
tsconfigFile: 'no-tsconfig.json',
}