diff --git a/changeLog.md b/changeLog.md index 811817b..9d2756e 100644 --- a/changeLog.md +++ b/changeLog.md @@ -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 diff --git a/helper.ts b/helper.ts index 30b104e..109d00c 100644 --- a/helper.ts +++ b/helper.ts @@ -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; }; diff --git a/package.json b/package.json index 66aaa5f..857c5e7 100644 --- a/package.json +++ b/package.json @@ -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": {