diff --git a/dist/index.js b/dist/index.js index f0eb854..4bc2c64 100644 --- a/dist/index.js +++ b/dist/index.js @@ -27655,7 +27655,12 @@ var parser = new import_fast_xml_parser.XMLParser({ textNodeName: "#text", parseAttributeValue: false, trimValues: true, - isArray: (name) => ["testsuite", "testcase", "failure", "error", "skipped"].includes(name) + isArray: (name) => ["testsuite", "testcase", "failure", "error", "skipped"].includes(name), + // JUnit reports with long failure messages can legitimately contain more + // than fast-xml-parser's default 1000-entity expansion cap. + processEntities: { + maxTotalExpansions: 1e5 + } }); function parseJunitXml(xml) { const doc = parser.parse(xml); diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 0000000..c533084 --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,3 @@ +allowBuilds: + '@biomejs/biome': true + esbuild: true diff --git a/src/main.test.ts b/src/main.test.ts index 9d8b950..0242000 100644 --- a/src/main.test.ts +++ b/src/main.test.ts @@ -48,6 +48,19 @@ test("parseJunitXml: handles nested ", () => { assert.equal(cases[0]!.classname, "inner.SuiteA"); }); +test("parseJunitXml: handles reports with more than 1000 XML entities", () => { + const entities = "&".repeat(1200); + const xml = ` + + + at ${entities} + +`; + const cases = parseJunitXml(xml); + assert.equal(cases.length, 1); + assert.equal(cases[0]!.status, "failed"); +}); + test("extractLocation: finds file/line in a node-style stack", () => { const loc = extractLocation( "AssertionError: boom\n at Object. (src/util.ts:42:7)\n at Module._compile", diff --git a/src/main.ts b/src/main.ts index 7ea6a16..567f50b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -48,6 +48,11 @@ const parser = new XMLParser({ trimValues: true, isArray: (name) => ["testsuite", "testcase", "failure", "error", "skipped"].includes(name), + // JUnit reports with long failure messages can legitimately contain more + // than fast-xml-parser's default 1000-entity expansion cap. + processEntities: { + maxTotalExpansions: 100_000, + }, }); export function parseJunitXml(xml: string): TestCase[] {