fix(run): do not count empty Surefire suites as ignored tests (#8084)

Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-12-05 11:46:20 +08:00
1 джерело c04fe9a72b
коміт bca532e4e3
2 files changed
+32 -1

No files matched your search

+3 -1
Переглянути файл
@@ -131,13 +131,15 @@ export function jvmParser(): TestOutputParser {
const failed = Number(m[2]) + Number(m[3]);
const run = Number(m[1]);
const skipped = Number(m[4]);
failure = null;
// Surefire reports empty suites (e.g. containers of nested tests); they are not ignored tests.
if (run === 0 && failed === 0 && skipped === 0) return events;
events.push({
type: "result",
path: [m[6]!],
status: failed > 0 ? "failed" : skipped === run ? "skipped" : "passed",
durationMs: parseDuration(m[5]),
});
failure = null;
return events;
}
if ((m = SUREFIRE_TOTAL_RE.exec(line))) {
+29
Переглянути файл
@@ -665,6 +665,35 @@ org.opentest4j.AssertionFailedError: expected: <3> but was: <2>
expect(r.summary).toMatchObject({ passed: 2, failed: 1 });
});
it("does not count an empty Surefire suite as an ignored test", () => {
const r = results(
jvmParser(),
`[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.152 s -- in com.acme.EmptyTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 2, Time elapsed: 0 s -- in com.acme.DisabledTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.01 s -- in com.acme.UserTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 2
`,
);
r.apply([
{ type: "result", path: ["com.acme.DisabledTest", "findAll"], status: "skipped" },
{ type: "result", path: ["com.acme.DisabledTest", "ownerDetails"], status: "skipped" },
{ type: "result", path: ["com.acme.UserTest", "findUser"], status: "passed" },
]);
expect(r.get("com.acme.EmptyTest")).toBeUndefined();
expect(r.counts()).toEqual({ passed: 1, failed: 0, skipped: 2, running: 0, total: 3 });
});
it("leaves a Surefire run with no tests empty", () => {
const r = results(
jvmParser(),
`[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s -- in com.acme.EmptyTest
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
`,
);
expect(r.roots).toEqual([]);
expect(r.counts()).toEqual({ passed: 0, failed: 0, skipped: 0, running: 0, total: 0 });
});
it("locates a TestNG failure in the test, past TestNG's own frames", () => {
const r = results(
jvmParser(),