Skip to content

Commit b1343fc

Browse files
committedDec 27, 2024
fix(jest-junit-reporter): report when entire suite fails
1 parent 30c1281 commit b1343fc

File tree

1 file changed

+19
-12
lines changed
  • projects/npm-tools/packages/jest-junit-reporter/src

1 file changed

+19
-12
lines changed
 

‎projects/npm-tools/packages/jest-junit-reporter/src/index.js

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,25 @@ module.exports = (report) => {
3737
};
3838

3939
const testResults = report.testResults
40-
.reduce(
41-
(results, suite) =>
42-
suite.testResults.length
43-
? results.concat(
44-
suite.testResults.map((test) => ({
45-
...test,
46-
testFilePath: suite.testFilePath,
47-
}))
48-
)
49-
: results,
50-
[]
51-
)
40+
.reduce((results, suite) => {
41+
if (suite.testResults.length) {
42+
results.concat(
43+
suite.testResults.map((test) => ({
44+
...test,
45+
testFilePath: suite.testFilePath,
46+
}))
47+
);
48+
} else if (suite.failureMessage) {
49+
results.push({
50+
duration: 0,
51+
failureMessages: [suite.failureMessage],
52+
fullName: suite.testFilePath,
53+
testFilePath: suite.testFilePath,
54+
});
55+
}
56+
57+
return results;
58+
}, [])
5259
.map((testCase) => {
5360
const results = [
5461
{

0 commit comments

Comments
 (0)