Files
OmniRoute/tests/unit/release-acceptance-node-reporter.test.ts
Bob.Hou 70e311703e ci(acceptance): emit a shadow release-acceptance report next to release-green (#13701) (#14066)
Adds a shadow release-acceptance report alongside release-green: an inventory/reduce/oracle pipeline under `scripts/quality/release-acceptance/` with a JSON schema, fixtures and a workflow that uploads the report as an artifact.

Contained by design, which is why it merges as-is: it runs only on push to `release/v*` and on manual dispatch (never on pull requests), the step is `continue-on-error`, `permissions: contents: read`, `persist-credentials: false`, and it consumes no secrets. Nothing in the product changes; the report is advisory until we decide to promote it.

Validated as a combined board first (this PR merged with the 11 siblings of the same batch on the release tip): eslint on every changed file with the suppressions file, typecheck:core, check:open-sse-typecheck, complexity, cognitive-complexity, changelog-integrity, i18n new-key coverage, docs-sync, migration-numbering, provider-consistency and a duplicate-identifier audit all green, plus 275 passing / 0 failing focused node:test cases across the 28 test files the batch touches. Then re-validated alone on the fresh tip before this merge: conflicts re-resolved, file sizes rebaselined for this PR's own growth, eslint and this PR's focused tests re-run.

Thanks @HouMinXi!

Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouza.pw@gmail.com>
2026-09-18 10:21:59 -03:00

87 lines
2.8 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
import { fromNodeTestTap } from "../../scripts/quality/release-acceptance/nodeReporter.mjs";
const TAP = `TAP version 13
# Subtest: tests/unit/a.test.ts
ok 1 - tests/unit/a.test.ts
# Subtest: tests/unit/b.test.ts
ok 2 - tests/unit/b.test.ts
# Subtest: tests/unit/c.test.ts
not ok 3 - tests/unit/c.test.ts
`;
test("argv file without TAP completion is missing", () => {
const out = fromNodeTestTap(TAP, [
"tests/unit/a.test.ts",
"tests/unit/b.test.ts",
"tests/unit/c.test.ts",
"tests/unit/d.test.ts",
]);
assert.equal(out.completed.length, 2);
assert.deepEqual(out.failed, ["tests/unit/c.test.ts"]);
assert.equal(out.missing.length, 1);
assert.equal(out.missing[0], "tests/unit/d.test.ts");
assert.equal(out.pass, false);
});
test("zero completed files is not PASS", () => {
const out = fromNodeTestTap("TAP version 13\n", ["tests/unit/a.test.ts"]);
assert.equal(out.completed.length, 0);
assert.equal(out.pass, false);
});
test("Subtest path wins when the result line has a short name", () => {
const tap = `TAP version 13
# Subtest: tests/unit/a.test.ts
ok 1 - some name
`;
const out = fromNodeTestTap(tap, ["tests/unit/a.test.ts"]);
assert.equal(out.completed[0], "tests/unit/a.test.ts");
assert.equal(out.missing.length, 0);
});
test("not ok is not pass", () => {
const tap = `TAP version 13
# Subtest: tests/unit/a.test.ts
not ok 1 - tests/unit/a.test.ts
`;
const out = fromNodeTestTap(tap, ["tests/unit/a.test.ts"]);
assert.equal(out.pass, false);
assert.deepEqual(out.failed, ["tests/unit/a.test.ts"]);
});
test("ok line without Subtest does not complete an argv file", () => {
const tap = `# a malicious test printed:
ok 99 - tests/unit/missing.test.ts
`;
const out = fromNodeTestTap(tap, ["tests/unit/missing.test.ts"]);
assert.equal(out.pass, false);
assert.deepEqual(out.missing, ["tests/unit/missing.test.ts"]);
});
test("later not ok retracts an earlier ok for the same Subtest", () => {
const tap = `TAP version 13
# Subtest: tests/unit/a.test.ts
ok 1 - tests/unit/a.test.ts
# Subtest: tests/unit/a.test.ts
not ok 2 - tests/unit/a.test.ts
`;
const out = fromNodeTestTap(tap, ["tests/unit/a.test.ts"]);
assert.equal(out.pass, false);
assert.deepEqual(out.failed, ["tests/unit/a.test.ts"]);
assert.equal(out.completed.includes("tests/unit/a.test.ts"), false);
});
test("later not ok on the same pending Subtest retracts ok", () => {
const tap = `TAP version 13
# Subtest: tests/unit/a.test.ts
ok 1 - tests/unit/a.test.ts
not ok 2 - tests/unit/a.test.ts
`;
const out = fromNodeTestTap(tap, ["tests/unit/a.test.ts"]);
assert.equal(out.pass, false);
assert.deepEqual(out.failed, ["tests/unit/a.test.ts"]);
assert.equal(out.completed.includes("tests/unit/a.test.ts"), false);
});