From 859f41b552808a0c0d196779cd8b220cafc5f5a1 Mon Sep 17 00:00:00 2001 From: Martin Fillafer Date: Wed, 8 Mar 2023 14:55:54 +0100 Subject: [PATCH] chore: build dist files --- __tests__/pytest-junit.test.ts | 8 ++++---- dist/index.js | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/__tests__/pytest-junit.test.ts b/__tests__/pytest-junit.test.ts index f9bd7b1..bfd78e3 100644 --- a/__tests__/pytest-junit.test.ts +++ b/__tests__/pytest-junit.test.ts @@ -1,15 +1,15 @@ import * as fs from 'fs' import * as path from 'path' -import { JestJunitParser } from '../src/parsers/jest-junit/jest-junit-parser' -import { ParseOptions } from '../src/test-parser' -import { normalizeFilePath } from '../src/utils/path-utils' +import {JestJunitParser} from '../src/parsers/jest-junit/jest-junit-parser' +import {ParseOptions} from '../src/test-parser' +import {normalizeFilePath} from '../src/utils/path-utils' describe('pytest-junit tests', () => { it('test with one successful test', async () => { const fixturePath = path.join(__dirname, 'fixtures', 'external', 'pytest', 'pytest-single-case.xml') const filePath = normalizeFilePath(path.relative(__dirname, fixturePath)) - const fileContent = fs.readFileSync(fixturePath, { encoding: 'utf8' }) + const fileContent = fs.readFileSync(fixturePath, {encoding: 'utf8'}) const opts: ParseOptions = { parseErrors: true, diff --git a/dist/index.js b/dist/index.js index 78b2f56..7a350c7 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1211,7 +1211,9 @@ class JestJunitParser { const sr = new test_results_1.TestSuiteResult(name, this.getGroups(ts), time); return sr; }); - const time = parseFloat(junit.testsuites.$.time) * 1000; + const time = junit.testsuites.$ === undefined + ? suites.reduce((sum, suite) => sum + suite.time, 0) + : parseFloat(junit.testsuites.$.time) * 1000; return new test_results_1.TestRunResult(path, suites, time); } getGroups(suite) {