Skip to content

Commit

Permalink
fix(helper): fix count issue after enable strip skip test option (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hazyzh authored Dec 26, 2023
1 parent 5206cbf commit 254e662
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
4 changes: 4 additions & 0 deletions changeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,7 @@
### 3.1.6

* skip the pending tests and suites in the final report https://github.com/Hazyzh/jest-html-reporters/issues/298

### 3.1.7

* fix count issue for skip pending tests option https://github.com/Hazyzh/jest-html-reporters/issues/298
15 changes: 12 additions & 3 deletions helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,17 @@ export const filterSkipTests = (obj: AggregatedResult): AggregatedResult => {
(test) => !(test.status === 'skipped' || test.status === 'pending')
);
});
obj.testResults = obj.testResults.filter(
(i) => !(i.skipped || i.testResults.length === 0)
);
let countTotalTests = 0;
obj.testResults = obj.testResults.filter((i) => {
const notSkipped = !(i.skipped || i.testResults.length === 0);
if (notSkipped) {
countTotalTests += i.testResults.length;
}
return notSkipped;
});
obj.numTotalTests = countTotalTests;
obj.numTotalTestSuites = obj.testResults.length;
obj.numPendingTestSuites = 0;
obj.numPendingTests = 0;
return obj;
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jest-html-reporters",
"license": "MIT",
"version": "3.1.6",
"version": "3.1.7",
"description": "Jest test results processor for generating a summary in HTML",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 254e662

Please sign in to comment.