Skip to content

Commit

Permalink
Use unique junit report filenames again (elastic#45897)
Browse files Browse the repository at this point in the history
Fix disappearing test results in pipelines
  • Loading branch information
brianseeders committed Sep 17, 2019
1 parent c08c6a7 commit b3b3703
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
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
2 changes: 1 addition & 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,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
));

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({
pretty: true,
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 b3b3703

Please sign in to comment.