Skip to content

Commit

Permalink
[7.3] Use unique junit report filenames again (#45897) (#45947)
Browse files Browse the repository at this point in the history
* Use unique junit report filenames again (#45897)

Fix disappearing test results in pipelines

* Fix more junit paths
  • Loading branch information
brianseeders authored Sep 18, 2019
1 parent e0ce4d9 commit cee5d87
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/dev/jest/integration_tests/junit_reporter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const MINUTE = 1000 * 60;
const ROOT_DIR = resolve(__dirname, '../../../../');
const FIXTURE_DIR = resolve(__dirname, '__fixtures__');
const TARGET_DIR = resolve(FIXTURE_DIR, 'target');
const XML_PATH = resolve(TARGET_DIR, 'junit', process.env.JOB || '.', 'TEST-Jest Tests.xml');
const XML_PATH = resolve(TARGET_DIR, 'junit', process.env.JOB || '.', `TEST-${process.env.JOB ? process.env.JOB + '-' : ''}Jest Tests.xml`);

afterAll(async () => {
await del(TARGET_DIR);
Expand Down
2 changes: 1 addition & 1 deletion src/dev/jest/junit_reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default class JestJUnitReporter {
rootDirectory,
'target/junit',
process.env.JOB || '.',
`TEST-${reportName}.xml`
`TEST-${process.env.JOB ? process.env.JOB + '-' : ''}${reportName}.xml`
);

const reportXML = root.end({
Expand Down
6 changes: 5 additions & 1 deletion src/dev/mocha/__tests__/junit_report_generation.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ describe('dev/mocha/junit report generation', () => {
mocha.addFile(resolve(PROJECT_DIR, 'test.js'));
await new Promise(resolve => mocha.run(resolve));
const report = await fcb(cb =>
parseString(readFileSync(resolve(PROJECT_DIR, 'target/junit', process.env.JOB || '.', 'TEST-test.xml')), cb)
parseString(
readFileSync(
resolve(PROJECT_DIR, 'target/junit', process.env.JOB || '.', `TEST-${process.env.JOB ? process.env.JOB + '-' : ''}test.xml`)
), cb
)
);

// test case results are wrapped in <testsuites></testsuites>
Expand Down
2 changes: 1 addition & 1 deletion src/dev/mocha/junit_report_generation.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export function setupJUnitReportGeneration(runner, options = {}) {
rootDirectory,
'target/junit',
process.env.JOB || '.',
`TEST-${reportName}.xml`
`TEST-${process.env.JOB ? process.env.JOB + '-' : ''}${reportName}.xml`
);

const reportXML = builder.end({
Expand Down
2 changes: 1 addition & 1 deletion tasks/config/karma.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module.exports = function (grunt) {
reporters: process.env.CI ? ['dots', 'junit'] : ['progress'],

junitReporter: {
outputFile: resolve(ROOT, 'target/junit', process.env.JOB || '.', 'TEST-karma.xml'),
outputFile: resolve(ROOT, 'target/junit', process.env.JOB || '.', `TEST-${process.env.JOB ? process.env.JOB + '-' : ''}karma.xml`),
useBrowserName: false,
nameFormatter: (browser, result) => [...result.suite, result.description].join(' '),
classNameFormatter: (browser, result) => {
Expand Down

0 comments on commit cee5d87

Please sign in to comment.