From b3b37037fef81c9c15151f0a7eb4f5c007476173 Mon Sep 17 00:00:00 2001 From: Brian Seeders Date: Tue, 17 Sep 2019 15:23:27 -0400 Subject: [PATCH] Use unique junit report filenames again (#45897) Fix disappearing test results in pipelines --- src/dev/jest/junit_reporter.js | 2 +- src/dev/mocha/__tests__/junit_report_generation.js | 2 +- src/dev/mocha/junit_report_generation.js | 2 +- tasks/config/karma.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dev/jest/junit_reporter.js b/src/dev/jest/junit_reporter.js index 22e23f9bfe26c..2298e47d1d869 100644 --- a/src/dev/jest/junit_reporter.js +++ b/src/dev/jest/junit_reporter.js @@ -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({ diff --git a/src/dev/mocha/__tests__/junit_report_generation.js b/src/dev/mocha/__tests__/junit_report_generation.js index b3fa399ea6580..7ec57660b6a82 100644 --- a/src/dev/mocha/__tests__/junit_report_generation.js +++ b/src/dev/mocha/__tests__/junit_report_generation.js @@ -50,7 +50,7 @@ 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')), + readFileSync(resolve(PROJECT_DIR, 'target/junit', process.env.JOB || '.', `TEST-${process.env.JOB ? process.env.JOB + '-' : ''}test.xml`)), cb )); diff --git a/src/dev/mocha/junit_report_generation.js b/src/dev/mocha/junit_report_generation.js index b7795f45096fa..b775d89cc99cf 100644 --- a/src/dev/mocha/junit_report_generation.js +++ b/src/dev/mocha/junit_report_generation.js @@ -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({ pretty: true, diff --git a/tasks/config/karma.js b/tasks/config/karma.js index 6723542c953b2..64ee9ffc50b6f 100644 --- a/tasks/config/karma.js +++ b/tasks/config/karma.js @@ -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) => {