test: распознавать исполнившийся subtest в outcome (#550)

Issue: #550
User-Visible: no
This commit is contained in:
Sergey Matyunin
2026-09-13 12:42:01 +03:00
parent 4d8ad3db32
commit d89b55ccf0
2 changed files with 18 additions and 1 deletions
+1 -1
View File
@@ -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);
+17
View File
@@ -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', () => {