Files
msd-core/tests/test-failure-reasons.test.cjs
Jakub Zych a9a7a328e6 refactor: hard-fork GSD -> MSD (Make Software Done)
Mechanical rename produced by scripts/msd-rename.cjs: gsd/Gsd/GSD -> msd/Msd/MSD
across contents and paths, upstream package/repo coordinates -> @golem15/msd-core
and golem15com/msd-core. Deep links into upstream history, sibling upstream
packages, the GSD-2 import feature, CHANGELOG.md and .changeset/ are kept as-is.

Hand edits on top: MSD block-letter banner and logos, LICENSE copyright line,
package/plugin identity, regenerated lockfile, install-tree fixtures, derived
registries and benchmark baseline; migration checksum baseline re-locked
(MSD keeps its own install state, so no install had applied the old sums);
sort-order and regex-escaped expectations in tests adjusted.
2026-10-06 01:47:40 +02:00

38 lines
1.6 KiB
JavaScript

const { test, describe } = require('node:test');
const assert = require('node:assert/strict');
const { TEST_GATE_REASON, classifyTestGateResult } = require('../scripts/msd-test-gate-reasons.cjs');
describe('test failure reason classification', () => {
test('classifies pass on exitCode 0', () => {
const out = classifyTestGateResult({ exitCode: 0, output: 'all good' });
assert.deepStrictEqual(out, { ok: true, reason: TEST_GATE_REASON.PASS });
});
test('classifies infrastructure failure via exitCode 2', () => {
const out = classifyTestGateResult({ exitCode: 2, output: 'ERROR: infrastructure failure' });
assert.deepStrictEqual(out, { ok: false, reason: TEST_GATE_REASON.INFRA_FAILURE });
});
test('classifies infrastructure failure via known worktree construct signature', () => {
const out = classifyTestGateResult({
exitCode: 1,
output: 'worktree.Construct: worktree construction failed at merge',
});
assert.deepStrictEqual(out, { ok: false, reason: TEST_GATE_REASON.INFRA_FAILURE });
});
test('classifies test failure via FAIL markers', () => {
const out = classifyTestGateResult({
exitCode: 1,
output: 'linux FAIL 11274/11277 tests (3 failures)',
});
assert.deepStrictEqual(out, { ok: false, reason: TEST_GATE_REASON.TEST_FAILURE });
});
test('classifies unknown failure when non-zero without known signatures', () => {
const out = classifyTestGateResult({ exitCode: 1, output: 'nonzero but unknown format' });
assert.deepStrictEqual(out, { ok: false, reason: TEST_GATE_REASON.UNKNOWN_FAILURE });
});
});