|
@@ -80,25 +80,25 @@ function saveSpecHash ([newSpecHash, newSpecInstallHash]) {
|
|
|
|
|
|
async function runElectronTests () {
|
|
|
const errors = []
|
|
|
- const runners = [
|
|
|
- ['Main process specs', 'main', runMainProcessElectronTests],
|
|
|
- ['Remote based specs', 'remote', runRemoteBasedElectronTests]
|
|
|
- ]
|
|
|
-
|
|
|
- const mochaFile = process.env.MOCHA_FILE
|
|
|
- for (const runner of runners) {
|
|
|
- if (runnersToRun && !runnersToRun.includes(runner[1])) {
|
|
|
- console.info('\nSkipping:', runner[0])
|
|
|
+ const runners = new Map([
|
|
|
+ ['main', { description: 'Main process specs', run: runMainProcessElectronTests }],
|
|
|
+ ['remote', { description: 'Remote based specs', run: runRemoteBasedElectronTests }]
|
|
|
+ ])
|
|
|
+
|
|
|
+ const testResultsDir = process.env.ELECTRON_TEST_RESULTS_DIR
|
|
|
+ for (const [runnerId, { description, run }] of runners) {
|
|
|
+ if (runnersToRun && !runnersToRun.includes(runnerId)) {
|
|
|
+ console.info('\nSkipping:', description)
|
|
|
continue
|
|
|
}
|
|
|
try {
|
|
|
- console.info('\nRunning:', runner[0])
|
|
|
- if (mochaFile) {
|
|
|
- process.env.MOCHA_FILE = mochaFile.replace('.xml', `-${runner[1]}.xml`)
|
|
|
+ console.info('\nRunning:', description)
|
|
|
+ if (testResultsDir) {
|
|
|
+ process.env.MOCHA_FILE = path.join(testResultsDir, `test-results-${runnerId}.xml`)
|
|
|
}
|
|
|
- await runner[2]()
|
|
|
+ await run()
|
|
|
} catch (err) {
|
|
|
- errors.push([runner[0], err])
|
|
|
+ errors.push([runnerId, err])
|
|
|
}
|
|
|
}
|
|
|
|