@robhowley/pi-structured-return 1.9.0 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/extensions/structured-return/config/project-config.ts +10 -0
- package/extensions/structured-return/config/registry.ts +306 -0
- package/extensions/structured-return/examples/.pi/machine-readable.json +18 -0
- package/extensions/structured-return/examples/.pi/parsers/foo-cli.ts +25 -0
- package/extensions/structured-return/{src/index.ts → index.ts} +94 -69
- package/extensions/structured-return/{src/parsers → parsers}/ava-text.ts +23 -15
- package/extensions/structured-return/{src/parsers → parsers}/bandit-json.ts +17 -15
- package/extensions/structured-return/{src/parsers → parsers}/black-text.ts +18 -18
- package/extensions/structured-return/{src/parsers → parsers}/cargo-build.ts +19 -14
- package/extensions/structured-return/{src/parsers → parsers}/cargo-test.ts +20 -19
- package/extensions/structured-return/parsers/checkstyle-xml.ts +183 -0
- package/extensions/structured-return/{src/parsers → parsers}/clang-text.ts +15 -13
- package/extensions/structured-return/{src/parsers → parsers}/dbt-json.ts +28 -23
- package/extensions/structured-return/{src/parsers → parsers}/dotnet-build-text.ts +10 -8
- package/extensions/structured-return/{src/parsers → parsers}/eslint-json.ts +15 -9
- package/extensions/structured-return/{src/parsers → parsers}/go-test-json.ts +23 -21
- package/extensions/structured-return/{src/parsers → parsers}/hadolint-json.ts +18 -12
- package/extensions/structured-return/{src/parsers → parsers}/htmlhint-json.ts +15 -13
- package/extensions/structured-return/{src/parsers → parsers}/isort-text.ts +18 -18
- package/extensions/structured-return/{src/parsers → parsers}/javac-text.ts +14 -12
- package/extensions/structured-return/{src/parsers → parsers}/jsonlint-text.ts +16 -14
- package/extensions/structured-return/{src/parsers → parsers}/junit-xml.ts +61 -43
- package/extensions/structured-return/{src/parsers → parsers}/markdownlint-json.ts +19 -17
- package/extensions/structured-return/{src/parsers → parsers}/minitest-text.ts +24 -15
- package/extensions/structured-return/{src/parsers → parsers}/mocha-json.ts +17 -10
- package/extensions/structured-return/{src/parsers → parsers}/mypy-json.ts +16 -16
- package/extensions/structured-return/{src/parsers → parsers}/node-test-text.ts +17 -14
- package/extensions/structured-return/{src/parsers → parsers}/npm-audit-json.ts +19 -16
- package/extensions/structured-return/{src/parsers → parsers}/prettier-text.ts +21 -17
- package/extensions/structured-return/{src/parsers → parsers}/pylint-json.ts +17 -17
- package/extensions/structured-return/{src/parsers → parsers}/pyright-json.ts +20 -18
- package/extensions/structured-return/{src/parsers → parsers}/rspec-json.ts +14 -14
- package/extensions/structured-return/{src/parsers → parsers}/rubocop-json.ts +22 -11
- package/extensions/structured-return/{src/parsers → parsers}/ruff-json.ts +7 -7
- package/extensions/structured-return/{src/parsers → parsers}/shellcheck-json.ts +14 -14
- package/extensions/structured-return/{src/parsers → parsers}/stylelint-json.ts +21 -13
- package/extensions/structured-return/{src/parsers → parsers}/swiftc-text.ts +16 -10
- package/extensions/structured-return/parsers/tail-fallback.ts +20 -0
- package/extensions/structured-return/{src/parsers → parsers}/tidy-text.ts +13 -13
- package/extensions/structured-return/{src/parsers → parsers}/tsc-text.ts +11 -11
- package/extensions/structured-return/{src/parsers → parsers}/unittest-text.ts +24 -14
- package/extensions/structured-return/{src/parsers → parsers}/utils.ts +9 -6
- package/extensions/structured-return/{src/parsers → parsers}/vale-json.ts +18 -18
- package/extensions/structured-return/{src/parsers → parsers}/vitest-json.ts +14 -14
- package/extensions/structured-return/{src/storage → storage}/log-store.ts +5 -5
- package/extensions/structured-return/{src/storage → storage}/session-stats.ts +11 -11
- package/extensions/structured-return/{src/types.ts → types.ts} +4 -2
- package/package.json +29 -44
- package/skills/structured-return/SKILL.md +7 -0
- package/LICENSE +0 -21
- package/extensions/structured-return/src/config/project-config.ts +0 -10
- package/extensions/structured-return/src/config/registry.test.ts +0 -171
- package/extensions/structured-return/src/config/registry.ts +0 -282
- package/extensions/structured-return/src/index.test.ts +0 -220
- package/extensions/structured-return/src/parsers/ava-text.test.ts +0 -116
- package/extensions/structured-return/src/parsers/bandit-json.test.ts +0 -90
- package/extensions/structured-return/src/parsers/black-text.test.ts +0 -67
- package/extensions/structured-return/src/parsers/cargo-build.test.ts +0 -170
- package/extensions/structured-return/src/parsers/cargo-test.test.ts +0 -191
- package/extensions/structured-return/src/parsers/clang-text.test.ts +0 -61
- package/extensions/structured-return/src/parsers/dbt-json.test.ts +0 -172
- package/extensions/structured-return/src/parsers/dotnet-build-text.test.ts +0 -85
- package/extensions/structured-return/src/parsers/eslint-json.test.ts +0 -60
- package/extensions/structured-return/src/parsers/go-test-json.test.ts +0 -119
- package/extensions/structured-return/src/parsers/hadolint-json.test.ts +0 -73
- package/extensions/structured-return/src/parsers/htmlhint-json.test.ts +0 -72
- package/extensions/structured-return/src/parsers/isort-text.test.ts +0 -58
- package/extensions/structured-return/src/parsers/javac-text.test.ts +0 -75
- package/extensions/structured-return/src/parsers/jsonlint-text.test.ts +0 -52
- package/extensions/structured-return/src/parsers/junit-xml.test.ts +0 -627
- package/extensions/structured-return/src/parsers/markdownlint-json.test.ts +0 -76
- package/extensions/structured-return/src/parsers/minitest-text.test.ts +0 -110
- package/extensions/structured-return/src/parsers/mocha-json.test.ts +0 -108
- package/extensions/structured-return/src/parsers/mypy-json.test.ts +0 -101
- package/extensions/structured-return/src/parsers/node-test-text.test.ts +0 -117
- package/extensions/structured-return/src/parsers/npm-audit-json.test.ts +0 -83
- package/extensions/structured-return/src/parsers/prettier-text.test.ts +0 -76
- package/extensions/structured-return/src/parsers/pylint-json.test.ts +0 -120
- package/extensions/structured-return/src/parsers/pyright-json.test.ts +0 -112
- package/extensions/structured-return/src/parsers/rspec-json.test.ts +0 -126
- package/extensions/structured-return/src/parsers/rubocop-json.test.ts +0 -118
- package/extensions/structured-return/src/parsers/ruff-json.test.ts +0 -57
- package/extensions/structured-return/src/parsers/shellcheck-json.test.ts +0 -110
- package/extensions/structured-return/src/parsers/stylelint-json.test.ts +0 -120
- package/extensions/structured-return/src/parsers/swiftc-text.test.ts +0 -73
- package/extensions/structured-return/src/parsers/tail-fallback.test.ts +0 -41
- package/extensions/structured-return/src/parsers/tail-fallback.ts +0 -20
- package/extensions/structured-return/src/parsers/tidy-text.test.ts +0 -74
- package/extensions/structured-return/src/parsers/tsc-text.test.ts +0 -81
- package/extensions/structured-return/src/parsers/unittest-text.test.ts +0 -126
- package/extensions/structured-return/src/parsers/vale-json.test.ts +0 -84
- package/extensions/structured-return/src/parsers/vitest-json.test.ts +0 -118
- package/extensions/structured-return/src/storage/session-stats.test.ts +0 -156
- package/extensions/structured-return/tsconfig.json +0 -11
- package/extensions/structured-return/vitest.config.ts +0 -9
- /package/extensions/structured-return/{src/ui → ui}/widget.ts +0 -0
|
@@ -1,627 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import os from "node:os";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { describe, it, expect } from "vitest";
|
|
5
|
-
import parser from "./junit-xml";
|
|
6
|
-
import type { RunContext } from "../types";
|
|
7
|
-
|
|
8
|
-
function makeCtx(xml: string, cwd = "/project"): RunContext {
|
|
9
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "junit-test-"));
|
|
10
|
-
const artifactPath = path.join(dir, "report.xml");
|
|
11
|
-
fs.writeFileSync(artifactPath, xml);
|
|
12
|
-
return {
|
|
13
|
-
command: "gradle test",
|
|
14
|
-
argv: ["gradle", "test"],
|
|
15
|
-
cwd,
|
|
16
|
-
artifactPaths: [artifactPath],
|
|
17
|
-
stdoutPath: path.join(dir, "stdout"),
|
|
18
|
-
stderrPath: path.join(dir, "stderr"),
|
|
19
|
-
logPath: path.join(dir, "log"),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function makeMultiCtx(xmlFiles: Record<string, string>, cwd = "/project"): RunContext {
|
|
24
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "junit-multi-"));
|
|
25
|
-
const artifactPaths: string[] = [];
|
|
26
|
-
for (const [name, xml] of Object.entries(xmlFiles)) {
|
|
27
|
-
const p = path.join(dir, name);
|
|
28
|
-
fs.writeFileSync(p, xml);
|
|
29
|
-
artifactPaths.push(p);
|
|
30
|
-
}
|
|
31
|
-
return {
|
|
32
|
-
command: "gradle test",
|
|
33
|
-
argv: ["gradle", "test"],
|
|
34
|
-
cwd,
|
|
35
|
-
artifactPaths,
|
|
36
|
-
stdoutPath: path.join(dir, "stdout"),
|
|
37
|
-
stderrPath: path.join(dir, "stderr"),
|
|
38
|
-
logPath: path.join(dir, "log"),
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const PASSING = (name: string, classname = "com.example.MyTest") =>
|
|
43
|
-
`<testcase name="${name}" classname="${classname}" time="0.001"/>`;
|
|
44
|
-
|
|
45
|
-
const FAILING = (
|
|
46
|
-
name: string,
|
|
47
|
-
classname: string,
|
|
48
|
-
message: string,
|
|
49
|
-
type = "AssertionError",
|
|
50
|
-
file?: string,
|
|
51
|
-
line?: number
|
|
52
|
-
) => {
|
|
53
|
-
const fileAttr = file ? ` file="${file}"` : "";
|
|
54
|
-
const lineAttr = line !== undefined ? ` line="${line}"` : "";
|
|
55
|
-
return `<testcase name="${name}" classname="${classname}"${fileAttr}${lineAttr} time="0.001">
|
|
56
|
-
<failure message="${message}" type="${type}">full details here</failure>
|
|
57
|
-
</testcase>`;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const ERROR = (name: string, classname: string, message: string, type = "RuntimeError") =>
|
|
61
|
-
`<testcase name="${name}" classname="${classname}" time="0.001">
|
|
62
|
-
<error message="${message}" type="${type}">stack trace</error>
|
|
63
|
-
</testcase>`;
|
|
64
|
-
|
|
65
|
-
describe("junit-xml parser", () => {
|
|
66
|
-
describe("testsuites wrapper (multi-suite)", () => {
|
|
67
|
-
it("mix of passed and failed → status fail, correct counts", async () => {
|
|
68
|
-
const xml = `<?xml version="1.0"?>
|
|
69
|
-
<testsuites>
|
|
70
|
-
<testsuite name="suite1" tests="2" failures="1" errors="0">
|
|
71
|
-
${PASSING("test_a")}
|
|
72
|
-
${FAILING("test_b", "com.example.MyTest", "expected 2 but was 1")}
|
|
73
|
-
</testsuite>
|
|
74
|
-
<testsuite name="suite2" tests="2" failures="0" errors="0">
|
|
75
|
-
${PASSING("test_c")}
|
|
76
|
-
${PASSING("test_d")}
|
|
77
|
-
</testsuite>
|
|
78
|
-
</testsuites>`;
|
|
79
|
-
const result = await parser.parse(makeCtx(xml));
|
|
80
|
-
expect(result.status).toBe("fail");
|
|
81
|
-
expect(result.summary).toBe("1 failed, 3 passed");
|
|
82
|
-
expect(result.failures).toHaveLength(1);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it("all passing → status pass", async () => {
|
|
86
|
-
const xml = `<testsuites>
|
|
87
|
-
<testsuite name="suite" tests="2" failures="0" errors="0">
|
|
88
|
-
${PASSING("test_a")}
|
|
89
|
-
${PASSING("test_b")}
|
|
90
|
-
</testsuite>
|
|
91
|
-
</testsuites>`;
|
|
92
|
-
const result = await parser.parse(makeCtx(xml));
|
|
93
|
-
expect(result.status).toBe("pass");
|
|
94
|
-
expect(result.summary).toBe("2 passed");
|
|
95
|
-
expect(result.failures).toHaveLength(0);
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
describe("bare testsuite (no wrapper)", () => {
|
|
100
|
-
it("single testsuite at root → parsed correctly", async () => {
|
|
101
|
-
const xml = `<testsuite name="suite" tests="2" failures="1" errors="0">
|
|
102
|
-
${PASSING("test_a")}
|
|
103
|
-
${FAILING("test_b", "com.example.MyTest", "assert failed")}
|
|
104
|
-
</testsuite>`;
|
|
105
|
-
const result = await parser.parse(makeCtx(xml));
|
|
106
|
-
expect(result.status).toBe("fail");
|
|
107
|
-
expect(result.summary).toBe("1 failed, 1 passed");
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
describe("error elements", () => {
|
|
112
|
-
it("error counts as failure, message surfaced", async () => {
|
|
113
|
-
const xml = `<testsuite name="suite" tests="2" failures="0" errors="1">
|
|
114
|
-
${PASSING("test_a")}
|
|
115
|
-
${ERROR("test_b", "com.example.MyTest", "NullPointerException", "java.lang.NullPointerException")}
|
|
116
|
-
</testsuite>`;
|
|
117
|
-
const result = await parser.parse(makeCtx(xml));
|
|
118
|
-
expect(result.status).toBe("fail");
|
|
119
|
-
expect(result.summary).toBe("1 failed, 1 passed");
|
|
120
|
-
expect(result.failures![0].message).toBe("NullPointerException");
|
|
121
|
-
expect(result.failures![0].rule).toBe("java.lang.NullPointerException");
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
describe("file and line resolution", () => {
|
|
126
|
-
it("file on testcase → relativized to cwd", async () => {
|
|
127
|
-
const xml = `<testsuite name="suite" tests="1" failures="1" errors="0">
|
|
128
|
-
${FAILING("test_b", "MyTest", "oops", "AssertionError", "/project/src/test/MyTest.java", 42)}
|
|
129
|
-
</testsuite>`;
|
|
130
|
-
const result = await parser.parse(makeCtx(xml, "/project"));
|
|
131
|
-
expect(result.failures![0].file).toBe("src/test/MyTest.java");
|
|
132
|
-
expect(result.failures![0].line).toBe(42);
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
it("non-php keeps testcase line when the body also has a parseable location", async () => {
|
|
136
|
-
const xml = `<testsuite name="MathTest" tests="1" failures="0" errors="1">
|
|
137
|
-
<testcase name="multipliesTwoNumbersCorrectly" classname="MathTest" file="/project/src/test/MyTest.java" line="42" time="0.001">
|
|
138
|
-
<error message="expected: <99> but was: <12>" type="org.opentest4j.AssertionFailedError"><![CDATA[org.opentest4j.AssertionFailedError: expected: <99> but was: <12>
|
|
139
|
-
at MathTest.multipliesTwoNumbersCorrectly(MyTest.java:13)
|
|
140
|
-
at java.base/java.lang.reflect.Method.invoke(Method.java:565)
|
|
141
|
-
]]></error>
|
|
142
|
-
</testcase>
|
|
143
|
-
</testsuite>`;
|
|
144
|
-
const result = await parser.parse(makeCtx(xml, "/project"));
|
|
145
|
-
expect(result.failures![0].file).toBe("src/test/MyTest.java");
|
|
146
|
-
expect(result.failures![0].line).toBe(42);
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it("file on testsuite (not testcase) → used as fallback", async () => {
|
|
150
|
-
const xml = `<testsuite name="suite" tests="1" failures="1" errors="0" file="src/spec/foo_spec.rb">
|
|
151
|
-
${FAILING("test_b", "MyTest", "oops")}
|
|
152
|
-
</testsuite>`;
|
|
153
|
-
const result = await parser.parse(makeCtx(xml, "/project"));
|
|
154
|
-
expect(result.failures![0].file).toBe("src/spec/foo_spec.rb");
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
it("no file attr → classname converted to java path", async () => {
|
|
158
|
-
const xml = `<testsuite name="suite" tests="1" failures="1" errors="0">
|
|
159
|
-
${FAILING("test_b", "com.example.service.MyTest", "oops")}
|
|
160
|
-
</testsuite>`;
|
|
161
|
-
const result = await parser.parse(makeCtx(xml));
|
|
162
|
-
expect(result.failures![0].file).toBe("com/example/service/MyTest.java");
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it("path-like classname with extension is treated as a file, not a java package", async () => {
|
|
166
|
-
const xml = `<testsuite name="suite" tests="1" failures="1" errors="0">
|
|
167
|
-
${FAILING("test_b", "math.test.ts", "oops")}
|
|
168
|
-
</testsuite>`;
|
|
169
|
-
const result = await parser.parse(makeCtx(xml));
|
|
170
|
-
expect(result.failures![0].file).toBe("math.test.ts");
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
describe("failure message", () => {
|
|
175
|
-
it("message attr surfaced directly", async () => {
|
|
176
|
-
const xml = `<testsuite name="suite" tests="1" failures="1" errors="0">
|
|
177
|
-
${FAILING("test_b", "MyTest", "expected: 99 but was: 12")}
|
|
178
|
-
</testsuite>`;
|
|
179
|
-
const result = await parser.parse(makeCtx(xml));
|
|
180
|
-
expect(result.failures![0].message).toBe("expected: 99 but was: 12");
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
it("failure type surfaced as rule", async () => {
|
|
184
|
-
const xml = `<testsuite name="suite" tests="1" failures="1" errors="0">
|
|
185
|
-
${FAILING("test_b", "MyTest", "oops", "org.junit.ComparisonFailure")}
|
|
186
|
-
</testsuite>`;
|
|
187
|
-
const result = await parser.parse(makeCtx(xml));
|
|
188
|
-
expect(result.failures![0].rule).toBe("org.junit.ComparisonFailure");
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
describe("go-junit-report output", () => {
|
|
193
|
-
it("extracts panic message and file:line from system-out when failure body is empty", async () => {
|
|
194
|
-
const xml = `<testsuites tests="2" failures="1">
|
|
195
|
-
<testsuite name="math-benchmark" tests="2" failures="1" errors="0">
|
|
196
|
-
<testcase name="TestAddsTwoNumbersCorrectly" classname="math-benchmark" time="0.000"/>
|
|
197
|
-
<testcase name="TestDoesNotPanic" classname="math-benchmark" time="0.000">
|
|
198
|
-
<failure message="Failed"></failure>
|
|
199
|
-
</testcase>
|
|
200
|
-
<system-out><![CDATA[panic: runtime error: invalid memory address or nil pointer dereference [recovered, repanicked]
|
|
201
|
-
goroutine 23 [running]:
|
|
202
|
-
math-benchmark.TestDoesNotPanic(0x123)
|
|
203
|
-
/project/math_test.go:22 +0x4
|
|
204
|
-
]]></system-out>
|
|
205
|
-
</testsuite>
|
|
206
|
-
</testsuites>`;
|
|
207
|
-
const result = await parser.parse(makeCtx(xml, "/project"));
|
|
208
|
-
expect(result.failures![0].message).toBe("runtime error: invalid memory address or nil pointer dereference");
|
|
209
|
-
expect(result.failures![0].file).toBe("math_test.go");
|
|
210
|
-
expect(result.failures![0].line).toBe(22);
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
it("extracts file, line, and message from Go failure body", async () => {
|
|
214
|
-
const xml = `<testsuites tests="2" failures="1">
|
|
215
|
-
<testsuite name="math-benchmark" tests="2" failures="1" errors="0">
|
|
216
|
-
<testcase name="TestAddsTwoNumbersCorrectly" classname="math-benchmark" time="0.000"/>
|
|
217
|
-
<testcase name="TestMultipliesTwoNumbersCorrectly" classname="math-benchmark" time="0.000">
|
|
218
|
-
<failure message="Failed"><![CDATA[ math_test.go:16: expected 99, got 12]]></failure>
|
|
219
|
-
</testcase>
|
|
220
|
-
</testsuite>
|
|
221
|
-
</testsuites>`;
|
|
222
|
-
const result = await parser.parse(makeCtx(xml, "/project"));
|
|
223
|
-
expect(result.failures![0].file).toBe("math_test.go");
|
|
224
|
-
expect(result.failures![0].line).toBe(16);
|
|
225
|
-
expect(result.failures![0].message).toBe("expected 99, got 12");
|
|
226
|
-
});
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
describe("maven / java stack trace output", () => {
|
|
230
|
-
it("extracts file and line from first frame matching classname", async () => {
|
|
231
|
-
const xml = `<testsuite name="MathTest" tests="1" failures="0" errors="1">
|
|
232
|
-
<testcase name="multipliesTwoNumbersCorrectly" classname="MathTest" time="0.001">
|
|
233
|
-
<error message="expected: <99> but was: <12>" type="org.opentest4j.AssertionFailedError"><![CDATA[org.opentest4j.AssertionFailedError: expected: <99> but was: <12>
|
|
234
|
-
at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
|
|
235
|
-
at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:150)
|
|
236
|
-
at MathTest.multipliesTwoNumbersCorrectly(MathTest.java:13)
|
|
237
|
-
at java.base/java.lang.reflect.Method.invoke(Method.java:565)
|
|
238
|
-
]]></error>
|
|
239
|
-
</testcase>
|
|
240
|
-
</testsuite>`;
|
|
241
|
-
const result = await parser.parse(makeCtx(xml));
|
|
242
|
-
expect(result.failures![0].file).toBe("MathTest.java");
|
|
243
|
-
expect(result.failures![0].line).toBe(13);
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
it("falls back to first non-framework frame when classname has no match", async () => {
|
|
247
|
-
const xml = `<testsuite name="suite" tests="1" failures="0" errors="1">
|
|
248
|
-
<testcase name="doesNotDivideByZero" classname="MathTest" time="0.001">
|
|
249
|
-
<error message="/ by zero" type="java.lang.ArithmeticException"><![CDATA[java.lang.ArithmeticException: / by zero
|
|
250
|
-
at MathTest.doesNotDivideByZero(MathTest.java:18)
|
|
251
|
-
at java.base/java.lang.reflect.Method.invoke(Method.java:565)
|
|
252
|
-
]]></error>
|
|
253
|
-
</testcase>
|
|
254
|
-
</testsuite>`;
|
|
255
|
-
const result = await parser.parse(makeCtx(xml));
|
|
256
|
-
expect(result.failures![0].file).toBe("MathTest.java");
|
|
257
|
-
expect(result.failures![0].line).toBe(18);
|
|
258
|
-
});
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
describe("dotnet / xunit output", () => {
|
|
262
|
-
it("extracts file and line from .NET stack trace body", async () => {
|
|
263
|
-
const xml = `<testsuites>
|
|
264
|
-
<testsuite name="dotnet.dll" tests="1" failures="1" errors="0">
|
|
265
|
-
<testcase classname="Benchmark.MathTest" name="DoesNotThrowOnNullAccess" time="0.001">
|
|
266
|
-
<failure type="failure" message="System.NullReferenceException : Object reference not set to an instance of an object.">at Benchmark.MathTest.DoesNotThrowOnNullAccess() in /project/MathTest.cs:line 21
|
|
267
|
-
at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)</failure>
|
|
268
|
-
</testcase>
|
|
269
|
-
</testsuite>
|
|
270
|
-
</testsuites>`;
|
|
271
|
-
const result = await parser.parse(makeCtx(xml));
|
|
272
|
-
expect(result.failures![0].file).toBe("MathTest.cs");
|
|
273
|
-
expect(result.failures![0].line).toBe(21);
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
it("decodes 
 entities in message attribute", async () => {
|
|
277
|
-
const xml = `<testsuites>
|
|
278
|
-
<testsuite name="dotnet.dll" tests="1" failures="1" errors="0">
|
|
279
|
-
<testcase classname="Benchmark.MathTest" name="MultipliesTwoNumbersCorrectly" time="0.001">
|
|
280
|
-
<failure type="failure" message="Assert.Equal() Failure: Values differ
Expected: 99
Actual: 12">at Benchmark.MathTest.MultipliesTwoNumbersCorrectly() in /project/MathTest.cs:line 14</failure>
|
|
281
|
-
</testcase>
|
|
282
|
-
</testsuite>
|
|
283
|
-
</testsuites>`;
|
|
284
|
-
const result = await parser.parse(makeCtx(xml));
|
|
285
|
-
expect(result.failures![0].message).toBe("Assert.Equal() Failure: Values differ\nExpected: 99\nActual: 12");
|
|
286
|
-
});
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
describe("pytest --junitxml output", () => {
|
|
290
|
-
it("extracts file and line from failure body when no file attr present", async () => {
|
|
291
|
-
const xml = `<?xml version="1.0" encoding="utf-8"?>
|
|
292
|
-
<testsuites name="pytest tests">
|
|
293
|
-
<testsuite name="pytest" errors="0" failures="1" skipped="0" tests="2">
|
|
294
|
-
<testcase classname="tests.test_math" name="test_adds" time="0.000"/>
|
|
295
|
-
<testcase classname="tests.test_math" name="test_multiplies" time="0.000">
|
|
296
|
-
<failure message="assert (3 * 4) == 99">def test_multiplies():
|
|
297
|
-
> assert 3 * 4 == 99
|
|
298
|
-
E assert (3 * 4) == 99
|
|
299
|
-
|
|
300
|
-
tests/test_math.py:5: AssertionError</failure>
|
|
301
|
-
</testcase>
|
|
302
|
-
</testsuite>
|
|
303
|
-
</testsuites>`;
|
|
304
|
-
const result = await parser.parse(makeCtx(xml, "/project"));
|
|
305
|
-
expect(result.failures![0].file).toBe("tests/test_math.py");
|
|
306
|
-
expect(result.failures![0].line).toBe(5);
|
|
307
|
-
expect(result.failures![0].message).toBe("assert (3 * 4) == 99");
|
|
308
|
-
});
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
describe("jest-junit output", () => {
|
|
312
|
-
it("extracts file, line, and message from plain-text failure elements", async () => {
|
|
313
|
-
const xml = `<?xml version="1.0" encoding="UTF-8"?>
|
|
314
|
-
<testsuites name="jest tests" tests="3" failures="2" errors="0">
|
|
315
|
-
<testsuite name="basic math" errors="0" failures="2" skipped="0" tests="3">
|
|
316
|
-
<testcase classname="basic math adds two numbers correctly" name="basic math adds two numbers correctly" time="0"/>
|
|
317
|
-
<testcase classname="basic math multiplies two numbers correctly" name="basic math multiplies two numbers correctly" time="0.001">
|
|
318
|
-
<failure>Error: expect(received).toBe(expected) // Object.is equality
|
|
319
|
-
|
|
320
|
-
Expected: 99
|
|
321
|
-
Received: 12
|
|
322
|
-
at Object.toBe (/project/math.test.js:7:19)
|
|
323
|
-
at Promise.then.completed (/project/node_modules/jest-circus/build/utils.js:298:28)</failure>
|
|
324
|
-
</testcase>
|
|
325
|
-
<testcase classname="basic math does not divide by zero" name="basic math does not divide by zero" time="0">
|
|
326
|
-
<failure>TypeError: Cannot read properties of null (reading 'value')
|
|
327
|
-
at Object.value (/project/math.test.js:11:25)
|
|
328
|
-
at Promise.then.completed (/project/node_modules/jest-circus/build/utils.js:298:28)</failure>
|
|
329
|
-
</testcase>
|
|
330
|
-
</testsuite>
|
|
331
|
-
</testsuites>`;
|
|
332
|
-
const result = await parser.parse(makeCtx(xml, "/project"));
|
|
333
|
-
expect(result.status).toBe("fail");
|
|
334
|
-
expect(result.summary).toBe("2 failed, 1 passed");
|
|
335
|
-
expect(result.failures![0].file).toBe("math.test.js");
|
|
336
|
-
expect(result.failures![0].line).toBe(7);
|
|
337
|
-
expect(result.failures![0].message).toBe(
|
|
338
|
-
"Error: expect(received).toBe(expected) // Object.is equality\nExpected: 99\nReceived: 12"
|
|
339
|
-
);
|
|
340
|
-
expect(result.failures![1].file).toBe("math.test.js");
|
|
341
|
-
expect(result.failures![1].line).toBe(11);
|
|
342
|
-
expect(result.failures![1].message).toBe("TypeError: Cannot read properties of null (reading 'value')");
|
|
343
|
-
});
|
|
344
|
-
});
|
|
345
|
-
|
|
346
|
-
describe("playwright --reporter=junit output", () => {
|
|
347
|
-
it("extracts file, line, and message from failure and error elements", async () => {
|
|
348
|
-
const xml = `<?xml version="1.0" encoding="UTF-8"?>
|
|
349
|
-
<testsuites id="" name="" tests="3" failures="1" skipped="0" errors="1" time="0.488">
|
|
350
|
-
<testsuite name="math.test.ts" tests="3" failures="1" errors="1" skipped="0" time="0.004">
|
|
351
|
-
<testcase name="basic math › adds two numbers correctly" classname="math.test.ts" time="0.002"></testcase>
|
|
352
|
-
<testcase name="basic math › multiplies two numbers correctly" classname="math.test.ts" time="0.001">
|
|
353
|
-
<failure message="expect(received).toBe(expected) // Object.is equality" type="expect.toBe">
|
|
354
|
-
<![CDATA[ math.test.ts:8:7 › basic math › multiplies two numbers correctly
|
|
355
|
-
|
|
356
|
-
Error: expect(received).toBe(expected) // Object.is equality
|
|
357
|
-
|
|
358
|
-
Expected: 99
|
|
359
|
-
Received: 12
|
|
360
|
-
|
|
361
|
-
7 |
|
|
362
|
-
8 | test("multiplies two numbers correctly", () => {
|
|
363
|
-
> 9 | expect(3 * 4).toBe(99);
|
|
364
|
-
| ^
|
|
365
|
-
10 | });
|
|
366
|
-
at /project/math.test.ts:9:19
|
|
367
|
-
]]>
|
|
368
|
-
</failure>
|
|
369
|
-
</testcase>
|
|
370
|
-
<testcase name="basic math › does not divide by zero" classname="math.test.ts" time="0.001">
|
|
371
|
-
<error message="Cannot read properties of null (reading 'value')" type="TypeError">
|
|
372
|
-
<![CDATA[ math.test.ts:12:7 › basic math › does not divide by zero
|
|
373
|
-
|
|
374
|
-
TypeError: Cannot read properties of null (reading 'value')
|
|
375
|
-
|
|
376
|
-
11 |
|
|
377
|
-
12 | test("does not divide by zero", () => {
|
|
378
|
-
> 13 | const result = (null as unknown as Record<string, number>).value;
|
|
379
|
-
| ^
|
|
380
|
-
at /project/math.test.ts:13:64
|
|
381
|
-
]]>
|
|
382
|
-
</error>
|
|
383
|
-
</testcase>
|
|
384
|
-
</testsuite>
|
|
385
|
-
</testsuites>`;
|
|
386
|
-
const result = await parser.parse(makeCtx(xml, "/project"));
|
|
387
|
-
expect(result.status).toBe("fail");
|
|
388
|
-
expect(result.summary).toBe("2 failed, 1 passed");
|
|
389
|
-
expect(result.failures![0].file).toBe("math.test.ts");
|
|
390
|
-
expect(result.failures![0].line).toBe(9);
|
|
391
|
-
expect(result.failures![0].message).toContain("expect(received).toBe(expected)");
|
|
392
|
-
expect(result.failures![0].message).toContain("Expected: 99");
|
|
393
|
-
expect(result.failures![0].message).toContain("Received: 12");
|
|
394
|
-
expect(result.failures![1].file).toBe("math.test.ts");
|
|
395
|
-
expect(result.failures![1].line).toBe(13);
|
|
396
|
-
expect(result.failures![1].message).toBe("Cannot read properties of null (reading 'value')");
|
|
397
|
-
});
|
|
398
|
-
});
|
|
399
|
-
|
|
400
|
-
describe("phpunit output", () => {
|
|
401
|
-
it("extracts file:line from body when tc.line is method definition line", async () => {
|
|
402
|
-
const xml = `<?xml version="1.0" encoding="UTF-8"?>
|
|
403
|
-
<testsuites>
|
|
404
|
-
<testsuite name="MathTest" file="/project/MathTest.php" tests="2" assertions="2" errors="0" failures="1">
|
|
405
|
-
<testcase name="testAddsTwoNumbersCorrectly" file="/project/MathTest.php" line="9" class="MathTest" classname="MathTest" assertions="1" time="0.000"/>
|
|
406
|
-
<testcase name="testMultipliesTwoNumbersCorrectly" file="/project/MathTest.php" line="14" class="MathTest" classname="MathTest" assertions="1" time="0.001">
|
|
407
|
-
<failure type="PHPUnit\\Framework\\ExpectationFailedException">MathTest::testMultipliesTwoNumbersCorrectly
|
|
408
|
-
Failed asserting that 12 is identical to 99.
|
|
409
|
-
|
|
410
|
-
/project/MathTest.php:16</failure>
|
|
411
|
-
</testcase>
|
|
412
|
-
</testsuite>
|
|
413
|
-
</testsuites>`;
|
|
414
|
-
const result = await parser.parse(makeCtx(xml, "/project"));
|
|
415
|
-
expect(result.status).toBe("fail");
|
|
416
|
-
expect(result.summary).toBe("1 failed, 1 passed");
|
|
417
|
-
expect(result.failures![0].file).toBe("MathTest.php");
|
|
418
|
-
expect(result.failures![0].line).toBe(16);
|
|
419
|
-
expect(result.failures![0].message).toBe("Failed asserting that 12 is identical to 99.");
|
|
420
|
-
expect(result.failures![0].rule).toBe("PHPUnit\\Framework\\ExpectationFailedException");
|
|
421
|
-
});
|
|
422
|
-
|
|
423
|
-
it("handles deeply nested testsuites (PHPUnit wraps in 3 levels)", async () => {
|
|
424
|
-
const xml = `<?xml version="1.0" encoding="UTF-8"?>
|
|
425
|
-
<testsuites>
|
|
426
|
-
<testsuite name="phpunit.xml" tests="3" assertions="2" errors="1" failures="1">
|
|
427
|
-
<testsuite name="default" tests="3" assertions="2" errors="1" failures="1">
|
|
428
|
-
<testsuite name="MathTest" file="/project/MathTest.php" tests="3" assertions="2" errors="1" failures="1">
|
|
429
|
-
<testcase name="testAddsTwoNumbersCorrectly" file="/project/MathTest.php" line="9" class="MathTest" classname="MathTest" assertions="1" time="0.000"/>
|
|
430
|
-
<testcase name="testMultipliesTwoNumbersCorrectly" file="/project/MathTest.php" line="14" class="MathTest" classname="MathTest" assertions="1" time="0.001">
|
|
431
|
-
<failure type="PHPUnit\\Framework\\ExpectationFailedException">MathTest::testMultipliesTwoNumbersCorrectly
|
|
432
|
-
Failed asserting that 12 is identical to 99.
|
|
433
|
-
|
|
434
|
-
/project/MathTest.php:16</failure>
|
|
435
|
-
</testcase>
|
|
436
|
-
<testcase name="testDoesNotDivideByZero" file="/project/MathTest.php" line="19" class="MathTest" classname="MathTest" assertions="0" time="0.000">
|
|
437
|
-
<error type="DivisionByZeroError">MathTest::testDoesNotDivideByZero
|
|
438
|
-
DivisionByZeroError: Division by zero
|
|
439
|
-
|
|
440
|
-
/project/MathTest.php:21</error>
|
|
441
|
-
</testcase>
|
|
442
|
-
</testsuite>
|
|
443
|
-
</testsuite>
|
|
444
|
-
</testsuite>
|
|
445
|
-
</testsuites>`;
|
|
446
|
-
const result = await parser.parse(makeCtx(xml, "/project"));
|
|
447
|
-
expect(result.status).toBe("fail");
|
|
448
|
-
expect(result.summary).toBe("2 failed, 1 passed");
|
|
449
|
-
expect(result.failures).toHaveLength(2);
|
|
450
|
-
expect(result.failures![0].file).toBe("MathTest.php");
|
|
451
|
-
expect(result.failures![0].line).toBe(16);
|
|
452
|
-
expect(result.failures![1].file).toBe("MathTest.php");
|
|
453
|
-
expect(result.failures![1].line).toBe(21);
|
|
454
|
-
});
|
|
455
|
-
|
|
456
|
-
it("extracts file:line from error body for exceptions", async () => {
|
|
457
|
-
const xml = `<?xml version="1.0" encoding="UTF-8"?>
|
|
458
|
-
<testsuites>
|
|
459
|
-
<testsuite name="MathTest" file="/project/MathTest.php" tests="1" assertions="0" errors="1" failures="0">
|
|
460
|
-
<testcase name="testDoesNotDivideByZero" file="/project/MathTest.php" line="19" class="MathTest" classname="MathTest" assertions="0" time="0.000">
|
|
461
|
-
<error type="DivisionByZeroError">MathTest::testDoesNotDivideByZero
|
|
462
|
-
DivisionByZeroError: Division by zero
|
|
463
|
-
|
|
464
|
-
/project/MathTest.php:21</error>
|
|
465
|
-
</testcase>
|
|
466
|
-
</testsuite>
|
|
467
|
-
</testsuites>`;
|
|
468
|
-
const result = await parser.parse(makeCtx(xml, "/project"));
|
|
469
|
-
expect(result.status).toBe("fail");
|
|
470
|
-
expect(result.failures![0].file).toBe("MathTest.php");
|
|
471
|
-
expect(result.failures![0].line).toBe(21);
|
|
472
|
-
expect(result.failures![0].message).toBe("DivisionByZeroError: Division by zero");
|
|
473
|
-
expect(result.failures![0].rule).toBe("DivisionByZeroError");
|
|
474
|
-
});
|
|
475
|
-
});
|
|
476
|
-
|
|
477
|
-
describe("pest (PHP) output", () => {
|
|
478
|
-
it("handles nested testsuites and extracts file:line from Pest stack frames", async () => {
|
|
479
|
-
const xml = `<?xml version="1.0" encoding="UTF-8"?>
|
|
480
|
-
<testsuites>
|
|
481
|
-
<testsuite name="phpunit.xml" tests="3" assertions="2" errors="1" failures="1" skipped="0" time="0.012">
|
|
482
|
-
<testsuite name="Tests" tests="3" assertions="2" errors="1" failures="1" skipped="0" time="0.012">
|
|
483
|
-
<testsuite name="Tests\\MathTest" file="tests/MathTest.php" tests="3" assertions="2" errors="1" failures="1" skipped="0" time="0.012">
|
|
484
|
-
<testcase name="it adds two numbers correctly" file="tests/MathTest.php::it adds two numbers correctly" class="Tests\\MathTest" classname="Tests.MathTest" assertions="1" time="0.005"/>
|
|
485
|
-
<testcase name="it multiplies two numbers correctly" file="tests/MathTest.php::it multiplies two numbers correctly" class="Tests\\MathTest" classname="Tests.MathTest" assertions="1" time="0.007">
|
|
486
|
-
<failure type="PHPUnit\\Framework\\ExpectationFailedException">it multiplies two numbers correctlyFailed asserting that 12 is identical to 99.
|
|
487
|
-
at tests/MathTest.php:8</failure>
|
|
488
|
-
</testcase>
|
|
489
|
-
<testcase name="it does not divide by zero" file="tests/MathTest.php::it does not divide by zero" class="Tests\\MathTest" classname="Tests.MathTest" assertions="0" time="0.0003">
|
|
490
|
-
<error type="DivisionByZeroError">it does not divide by zeroDivisionByZeroError: Division by zero
|
|
491
|
-
at tests/MathTest.php:12</error>
|
|
492
|
-
</testcase>
|
|
493
|
-
</testsuite>
|
|
494
|
-
</testsuite>
|
|
495
|
-
</testsuite>
|
|
496
|
-
</testsuites>`;
|
|
497
|
-
const result = await parser.parse(makeCtx(xml, "/project"));
|
|
498
|
-
expect(result.status).toBe("fail");
|
|
499
|
-
expect(result.summary).toBe("2 failed, 1 passed");
|
|
500
|
-
expect(result.failures).toHaveLength(2);
|
|
501
|
-
expect(result.failures![0].file).toBe("tests/MathTest.php");
|
|
502
|
-
expect(result.failures![0].line).toBe(8);
|
|
503
|
-
expect(result.failures![0].message).toBe("Failed asserting that 12 is identical to 99.");
|
|
504
|
-
expect(result.failures![0].rule).toBe("PHPUnit\\Framework\\ExpectationFailedException");
|
|
505
|
-
expect(result.failures![1].file).toBe("tests/MathTest.php");
|
|
506
|
-
expect(result.failures![1].line).toBe(12);
|
|
507
|
-
expect(result.failures![1].message).toBe("DivisionByZeroError: Division by zero");
|
|
508
|
-
expect(result.failures![1].rule).toBe("DivisionByZeroError");
|
|
509
|
-
});
|
|
510
|
-
|
|
511
|
-
it("strips '::test name' suffix from file attributes", async () => {
|
|
512
|
-
const xml = `<testsuite name="Tests\\MathTest" file="tests/MathTest.php" tests="1" failures="1" errors="0">
|
|
513
|
-
<testcase name="it fails" file="tests/MathTest.php::it fails" classname="Tests.MathTest">
|
|
514
|
-
<failure type="Error">it failsOops
|
|
515
|
-
at tests/MathTest.php:5</failure>
|
|
516
|
-
</testcase>
|
|
517
|
-
</testsuite>`;
|
|
518
|
-
const result = await parser.parse(makeCtx(xml, "/project"));
|
|
519
|
-
expect(result.failures![0].file).toBe("tests/MathTest.php");
|
|
520
|
-
});
|
|
521
|
-
});
|
|
522
|
-
|
|
523
|
-
describe("multi-suite totals", () => {
|
|
524
|
-
it("failures and errors summed across suites", async () => {
|
|
525
|
-
const xml = `<testsuites>
|
|
526
|
-
<testsuite name="s1" tests="2" failures="1" errors="0">
|
|
527
|
-
${PASSING("a")}
|
|
528
|
-
${FAILING("b", "Foo", "oops")}
|
|
529
|
-
</testsuite>
|
|
530
|
-
<testsuite name="s2" tests="2" failures="0" errors="1">
|
|
531
|
-
${PASSING("c")}
|
|
532
|
-
${ERROR("d", "Bar", "boom")}
|
|
533
|
-
</testsuite>
|
|
534
|
-
</testsuites>`;
|
|
535
|
-
const result = await parser.parse(makeCtx(xml));
|
|
536
|
-
expect(result.status).toBe("fail");
|
|
537
|
-
expect(result.summary).toBe("2 failed, 2 passed");
|
|
538
|
-
expect(result.failures).toHaveLength(2);
|
|
539
|
-
});
|
|
540
|
-
|
|
541
|
-
it("collects direct and nested testcases without double counting", async () => {
|
|
542
|
-
const xml = `<testsuites>
|
|
543
|
-
<testsuite name="root" tests="3" failures="2" errors="0">
|
|
544
|
-
${FAILING("direct_failure", "RootTest", "direct broke")}
|
|
545
|
-
<testsuite name="nested" tests="2" failures="1" errors="0">
|
|
546
|
-
${PASSING("nested_pass", "NestedTest")}
|
|
547
|
-
${FAILING("nested_failure", "NestedTest", "nested broke")}
|
|
548
|
-
</testsuite>
|
|
549
|
-
</testsuite>
|
|
550
|
-
</testsuites>`;
|
|
551
|
-
const result = await parser.parse(makeCtx(xml));
|
|
552
|
-
expect(result.status).toBe("fail");
|
|
553
|
-
expect(result.summary).toBe("2 failed, 1 passed");
|
|
554
|
-
expect(result.failures).toHaveLength(2);
|
|
555
|
-
expect(result.failures![0].message).toBe("direct broke");
|
|
556
|
-
expect(result.failures![1].message).toBe("nested broke");
|
|
557
|
-
});
|
|
558
|
-
});
|
|
559
|
-
|
|
560
|
-
describe("multi-file artifact paths (Gradle-style)", () => {
|
|
561
|
-
it("aggregates results across multiple XML files", async () => {
|
|
562
|
-
const ctx = makeMultiCtx({
|
|
563
|
-
"TEST-com.example.FooTest.xml": `<testsuite name="com.example.FooTest" tests="2" failures="1" errors="0">
|
|
564
|
-
${PASSING("test_a")}
|
|
565
|
-
${FAILING("test_b", "com.example.FooTest", "expected 2 but was 1")}
|
|
566
|
-
</testsuite>`,
|
|
567
|
-
"TEST-com.example.BarTest.xml": `<testsuite name="com.example.BarTest" tests="3" failures="0" errors="0">
|
|
568
|
-
${PASSING("test_c")}
|
|
569
|
-
${PASSING("test_d")}
|
|
570
|
-
${PASSING("test_e")}
|
|
571
|
-
</testsuite>`,
|
|
572
|
-
});
|
|
573
|
-
const result = await parser.parse(ctx);
|
|
574
|
-
expect(result.status).toBe("fail");
|
|
575
|
-
expect(result.summary).toBe("1 failed, 4 passed");
|
|
576
|
-
expect(result.failures).toHaveLength(1);
|
|
577
|
-
expect(result.failures![0].message).toBe("expected 2 but was 1");
|
|
578
|
-
});
|
|
579
|
-
|
|
580
|
-
it("all passing across multiple files → status pass", async () => {
|
|
581
|
-
const ctx = makeMultiCtx({
|
|
582
|
-
"TEST-FooTest.xml": `<testsuite name="FooTest" tests="2" failures="0" errors="0">
|
|
583
|
-
${PASSING("a")}
|
|
584
|
-
${PASSING("b")}
|
|
585
|
-
</testsuite>`,
|
|
586
|
-
"TEST-BarTest.xml": `<testsuite name="BarTest" tests="1" failures="0" errors="0">
|
|
587
|
-
${PASSING("c")}
|
|
588
|
-
</testsuite>`,
|
|
589
|
-
});
|
|
590
|
-
const result = await parser.parse(ctx);
|
|
591
|
-
expect(result.status).toBe("pass");
|
|
592
|
-
expect(result.summary).toBe("3 passed");
|
|
593
|
-
expect(result.failures).toHaveLength(0);
|
|
594
|
-
});
|
|
595
|
-
|
|
596
|
-
it("failures across multiple files are all collected", async () => {
|
|
597
|
-
const ctx = makeMultiCtx({
|
|
598
|
-
"TEST-FooTest.xml": `<testsuite name="FooTest" tests="2" failures="1" errors="0">
|
|
599
|
-
${PASSING("a")}
|
|
600
|
-
${FAILING("b", "FooTest", "foo broke")}
|
|
601
|
-
</testsuite>`,
|
|
602
|
-
"TEST-BarTest.xml": `<testsuite name="BarTest" tests="2" failures="0" errors="1">
|
|
603
|
-
${PASSING("c")}
|
|
604
|
-
${ERROR("d", "BarTest", "bar exploded")}
|
|
605
|
-
</testsuite>`,
|
|
606
|
-
});
|
|
607
|
-
const result = await parser.parse(ctx);
|
|
608
|
-
expect(result.status).toBe("fail");
|
|
609
|
-
expect(result.summary).toBe("2 failed, 2 passed");
|
|
610
|
-
expect(result.failures).toHaveLength(2);
|
|
611
|
-
expect(result.failures![0].message).toBe("foo broke");
|
|
612
|
-
expect(result.failures![1].message).toBe("bar exploded");
|
|
613
|
-
});
|
|
614
|
-
|
|
615
|
-
it("skips empty artifact files gracefully", async () => {
|
|
616
|
-
const ctx = makeMultiCtx({
|
|
617
|
-
"TEST-FooTest.xml": `<testsuite name="FooTest" tests="1" failures="0" errors="0">
|
|
618
|
-
${PASSING("a")}
|
|
619
|
-
</testsuite>`,
|
|
620
|
-
"TEST-Empty.xml": "",
|
|
621
|
-
});
|
|
622
|
-
const result = await parser.parse(ctx);
|
|
623
|
-
expect(result.status).toBe("pass");
|
|
624
|
-
expect(result.summary).toBe("1 passed");
|
|
625
|
-
});
|
|
626
|
-
});
|
|
627
|
-
});
|