diff --git a/spec/main-process/mocha-test-runner.js b/spec/main-process/mocha-test-runner.js index 0fe5a5125..d1634fd72 100644 --- a/spec/main-process/mocha-test-runner.js +++ b/spec/main-process/mocha-test-runner.js @@ -7,7 +7,24 @@ import {assert} from 'chai' export default function (testPaths) { global.assert = assert - const mocha = new Mocha({reporter: 'spec'}) + let reporterOptions = { + reporterEnabled: 'list' + } + + if (process.env.TEST_JUNIT_XML_PATH) { + console.log(`Mocha: Producing JUnit XML output at ${process.env.TEST_JUNIT_XML_PATH}.`) + reporterOptions = { + reporterEnabled: 'list, mocha-junit-reporter', + mochaJunitReporterReporterOptions: { + mochaFile: process.env.TEST_JUNIT_XML_PATH + } + } + } + + const mocha = new Mocha({ + reporter: 'mocha-multi-reporters', + reporterOptions + }) for (let testPath of testPaths) { if (fs.isDirectorySync(testPath)) { for (let testFilePath of fs.listTreeSync(testPath)) {