diff --git a/scripts/mutation-guard-outcome.mjs b/scripts/mutation-guard-outcome.mjs index 43dc9a47..96b38a75 100644 --- a/scripts/mutation-guard-outcome.mjs +++ b/scripts/mutation-guard-outcome.mjs @@ -90,7 +90,7 @@ const ORACLE_SETUP_FAILURE = new RegExp([ // Test frameworks include user/fixture text in failure diagnostics. A fixture // may literally mention ERR_MODULE_NOT_FOUND, so a proven assertion failure // must win over a setup-looking substring quoted inside that assertion. -const ASSERTION_EVIDENCE = /(?:ERR_ASSERTION|AssertionError|^FAILED\s+\S+)/im; +const ASSERTION_EVIDENCE = /(?:ERR_ASSERTION|AssertionError|^FAILED\s+\S+|^# Subtest:|^✖\s+)/im; export function classifyCommandResult(result, { phase = 'oracle', proof = MUTATION_PROOF.ASSERTION } = {}) { const stopped = interruption(result); diff --git a/test/mutation-guard-outcome.test.mjs b/test/mutation-guard-outcome.test.mjs index adbd4ee1..6e1e5cc5 100644 --- a/test/mutation-guard-outcome.test.mjs +++ b/test/mutation-guard-outcome.test.mjs @@ -61,6 +61,23 @@ test('#550 fixture: real named assertion failure is reusable proof', () => { }); assert.equal(quotedFixture.kind, MUTATION_OUTCOME.ASSERTION_KILLED, 'слово из fixture внутри AssertionError не маскирует реальное падение теста'); + const runtimeEnoent = runGuardPhases('node --test ledger.test.mjs', { + execute: () => result(1, [ + '# Subtest: ledger writes immediately', + 'not ok 1 - ledger writes immediately', + "error: ENOENT: no such file or directory, open 'ledger.json'", + ].join('\n')), + }); + assert.equal(runtimeEnoent.kind, MUTATION_OUTCOME.ASSERTION_KILLED, + 'ошибка поведения внутри исполнившегося subtest не становится setup failure'); + const specReporter = runGuardPhases('node --test ledger.test.mjs', { + execute: () => result(1, [ + '✖ ledger writes immediately (2ms)', + "Error: ENOENT: no such file or directory, open 'ledger.json'", + ].join('\n')), + }); + assert.equal(specReporter.kind, MUTATION_OUTCOME.ASSERTION_KILLED, + 'node spec reporter также доказывает, что именованный test исполнился'); }); test('#550 fixture: green named assertion means the mutant survived', () => {