Skip to content

Commit

Permalink
fix: handle missing todo in test result (#7779)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Feb 2, 2019
1 parent 2780a77 commit 4ea8462
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- `[jest-config]` Make sure `normalize` can consume `Defaults` without warnings ([#7742](https://github.com/facebook/jest/pull/7742))
- `[jest-config]` Allow `moduleFileExtensions` without 'js' for custom runners ([#7751](https://github.com/facebook/jest/pull/7751))
- `[jest-cli]` Load transformers before installing require hooks ([#7752](https://github.com/facebook/jest/pull/7752)
- `[jest-cli]` Handle missing `numTodoTests` in test results ([#7779](https://github.com/facebook/jest/pull/7779))

### Chore & Maintenance

Expand Down
6 changes: 6 additions & 0 deletions packages/jest-cli/src/testResultHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ export const addResult = (
aggregatedResults: AggregatedResult,
testResult: TestResult,
): void => {
// `todos` are new as of Jest 24, and not all runners return it.
// Set it to `0` to avoid `NaN`
if (!testResult.numTodoTests) {
testResult.numTodoTests = 0;
}

aggregatedResults.testResults.push(testResult);
aggregatedResults.numTotalTests +=
testResult.numPassingTests +
Expand Down

0 comments on commit 4ea8462

Please sign in to comment.