Skip to content

Commit

Permalink
Merge pull request #33 from palmerj3/fixTestNumber
Browse files Browse the repository at this point in the history
Fix test number
  • Loading branch information
palmerj3 committed Nov 15, 2017
2 parents 7b60dab + c35c423 commit d5e9b1b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions __tests__/buildJsonResults.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ const buildJsonResults = require('../utils/buildJsonResults');
const constants = require('../constants/index');

describe('buildJsonResults', () => {
it('should contain number of tests in testSuite', () => {
const noFailingTestsReport = require('../__mocks__/no-failing-tests.json');
const jsonResults = buildJsonResults(noFailingTestsReport, '', constants.DEFAULT_OPTIONS);

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

it('should return the proper name from ancestorTitles when usePathForSuiteName is "false"', () => {
const noFailingTestsReport = require('../__mocks__/no-failing-tests.json');
const jsonResults = buildJsonResults(noFailingTestsReport, '', constants.DEFAULT_OPTIONS);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jest-junit",
"version": "3.2.1",
"version": "3.3.0",
"description": "A jest result processor that generates junit xml files",
"main": "index.js",
"repository": "https://github.com/palmerj3/jest-junit",
Expand Down
3 changes: 2 additions & 1 deletion utils/buildJsonResults.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ module.exports = function (report, appDirectory, options) {
failures: suite.numFailingTests,
skipped: suite.numPendingTests,
timestamp: (new Date(suite.perfStats.start)).toISOString().slice(0, -5),
time: (suite.perfStats.end - suite.perfStats.start) / 1000
time: (suite.perfStats.end - suite.perfStats.start) / 1000,
tests: suite.numFailingTests + suite.numPassingTests + suite.numPendingTests
}
}]
};
Expand Down

0 comments on commit d5e9b1b

Please sign in to comment.