test(#1279): RED — isNodeTestRed pure helper mutation + property pins (FF-03/FF-06)

This commit is contained in:
Dave
2026-06-15 22:38:06 -04:00
parent 88a1e5da5a
commit a241c5fb8b
2 changed files with 21 additions and 0 deletions

View File

@@ -57,4 +57,14 @@ describe('prohibition-enforcement properties (#1259)', () => {
assert.ok(Number.isInteger(n) && n >= 0);
}));
});
// ─── #1279 isNodeTestRed (FF-03 / FF-06) ───
test('isNodeTestRed agrees with parseNodeTestSummary().fail >= 1 and never throws', () => {
const enforce = require(ENFORCEMENT_LIB);
fc.assert(fc.property(fc.string(), (s) => {
const red = enforce.isNodeTestRed(s);
assert.equal(red, enforce.parseNodeTestSummary(s).fail >= 1,
'isNodeTestRed(s) === (parseNodeTestSummary(s).fail >= 1)');
}));
});
});

View File

@@ -358,6 +358,17 @@ describe('prohibition-enforcement real-runner helpers (#1259)', () => {
assert.deepEqual(enforce.parseNodeTestSummary('no summary here'), { tests: 0, pass: 0, fail: 0, cancelled: 0 });
});
// ─── #1279 isNodeTestRed pure helper (FF-03 / FF-06) — mutation-pinned `>= 1` boundary ───
test('isNodeTestRed is true iff the TAP summary reports # fail >= 1 (mutation-pinned boundary)', () => {
const enforce = require(ENFORCEMENT_LIB);
// The `# fail 1` case is load-bearing: it pins `>= 1`, not `> 1`. A mutant flipping `>=`→`>`
// (or bumping the threshold) flips this assertion and is caught.
assert.equal(enforce.isNodeTestRed('# fail 1\n'), true, '# fail 1 is RED (boundary: >= 1, not > 1)');
assert.equal(enforce.isNodeTestRed('# fail 0\n'), false, '# fail 0 is not RED');
assert.equal(enforce.isNodeTestRed('# fail 2\n'), true, '# fail 2 is RED');
assert.equal(enforce.isNodeTestRed('no summary'), false, 'no parseable summary -> not RED (fail-closed for the prover)');
});
test('tapTestNames EXCLUDES skipped/todo tests (they never ran, m1)', () => {
const enforce = require(ENFORCEMENT_LIB);
assert.deepEqual(enforce.tapTestNames('ok 1 - guards the must-NOT\nok 2 - other # SKIP\nok 3 - later # TODO\n'),