Skip to content

Commit

Permalink
Add todo count to total test count
Browse files Browse the repository at this point in the history
  • Loading branch information
maaarghk committed Oct 6, 2023
1 parent 3435179 commit 11d9753
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions __tests__/buildJsonResults.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,13 @@ describe('buildJsonResults', () => {
expect(jsonResults.testsuites[1].testsuite[0]._attr.skipped).toBe(1);
});

it('should include number of todo tests in testSuite total count', () => {
const noFailingTestsWithTodoReport = require('../__mocks__/no-failing-tests-with-todo.json');
jsonResults = buildJsonResults(noFailingTestsWithTodoReport, '/', constants.DEFAULT_OPTIONS);

expect(jsonResults.testsuites[1].testsuite[0]._attr.tests).toBe(2);
});

it('should include a skipped tag when outputting todo tests', () => {
const noFailingTestsWithTodoReport = require('../__mocks__/no-failing-tests-with-todo.json');
jsonResults = buildJsonResults(noFailingTestsWithTodoReport, '/', constants.DEFAULT_OPTIONS);
Expand Down
2 changes: 1 addition & 1 deletion utils/buildJsonResults.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ module.exports = function (report, appDirectory, options, rootDir = null) {
suiteNameVariables[constants.DISPLAY_NAME_VAR] = displayName;

// Add <testsuite /> properties
const suiteNumTests = suite.numFailingTests + suite.numPassingTests + suite.numPendingTests;
const suiteNumTests = suite.numFailingTests + suite.numPassingTests + suite.numPendingTests + (suite.numTodoTests ? suite.numTodoTests: 0);
const suiteExecutionTime = executionTime(suite.perfStats.start, suite.perfStats.end);

const suiteErrors = noResults ? 1 : 0;
Expand Down

0 comments on commit 11d9753

Please sign in to comment.