feat: report skipped PostgreSQL subtests even when their parent test passes

This commit is contained in:
Matthew Meszaros
2026-10-30 14:18:47 +01:00
parent ca73a18459
commit a9ff0802bb
2 changed files with 18 additions and 4 deletions
+7 -4
View File
@@ -3,6 +3,7 @@ import { pathToFileURL } from "node:url";
export function summarizeLiveTests(input, outcome) {
const tests = new Map();
const subtests = new Map();
const failedPackages = new Set();
for (const line of input.split("\n")) {
let event;
@@ -15,14 +16,16 @@ export function summarizeLiveTests(input, outcome) {
if (event.Action === "fail" && typeof event.Package === "string" && !event.Test) {
failedPackages.add(event.Package);
}
if (typeof event.Test !== "string" || !event.Test.startsWith("TestLive") || event.Test.includes("/")) continue;
if (typeof event.Test !== "string" || !event.Test.startsWith("TestLive")) continue;
if (!["pass", "fail", "skip"].includes(event.Action)) continue;
tests.set(`${event.Package}/${event.Test}`, event.Action);
const results = event.Test.includes("/") ? subtests : tests;
results.set(`${event.Package}/${event.Test}`, event.Action);
}
const names = (action) => [...tests].filter(([, result]) => result === action).map(([name]) => name).sort();
const passed = names("pass");
const failed = names("fail");
const skipped = names("skip");
const skippedSubtests = [...subtests].filter(([, result]) => result === "skip").map(([name]) => name).sort();
const list = (heading, entries) => [
`### ${heading}`,
"",
@@ -31,7 +34,7 @@ export function summarizeLiveTests(input, outcome) {
"",
];
return {
needsAttention: outcome !== "success" || tests.size === 0 || failed.length > 0 || skipped.length > 0 || failedPackages.size > 0,
needsAttention: outcome !== "success" || tests.size === 0 || failed.length > 0 || skipped.length > 0 || skippedSubtests.length > 0 || failedPackages.size > 0,
markdown: [
"## PostgreSQL catch-all (advisory)",
"",
@@ -46,7 +49,7 @@ export function summarizeLiveTests(input, outcome) {
...(tests.size === 0 ? ["No completed TestLive results were recorded. Check setup, compilation and timeouts.", ""] : []),
...list("Failed packages (including setup or build failures)", [...failedPackages].sort()),
...list("Failed tests", failed),
...list("Skipped tests", skipped),
...list("Skipped tests and subtests", [...skipped, ...skippedSubtests]),
"Full JSON events and compiler output are retained in the postgres-live-advisory artifact. Subtests are included there; counts above include each top-level test once.",
"",
].join("\n"),
@@ -36,3 +36,14 @@ test("successful coverage is clean only when completed tests contain no skips",
assert.equal(summarizeLiveTests(events({ Action: "pass", Package: "app", Test: "TestLiveOK" }), "success").needsAttention, false);
assert.equal(summarizeLiveTests(events({ Action: "skip", Package: "app", Test: "TestLiveSkipped" }), "success").needsAttention, true);
});
test("a skipped subtest is actionable even when its parent passes", () => {
const report = summarizeLiveTests(events(
{ Action: "skip", Package: "app", Test: "TestLiveExample/needs-fixture" },
{ Action: "pass", Package: "app", Test: "TestLiveExample" },
), "success");
assert.equal(report.needsAttention, true);
assert.match(report.markdown, /\| Passed \| 1 \|/);
assert.match(report.markdown, /\| Skipped \| 0 \|/);
assert.match(report.markdown, /`app\/TestLiveExample\/needs-fixture`/);
});