ci: do not use the MOCHA_FILE env variable (#19171)

It is not used in a expected way anyway.
This commit is contained in:
Alexey Kuzmin 2019-07-09 23:56:46 +03:00 committed by John Kleinschmidt
parent e3440f1975
commit 015e1348e0
2 changed files with 19 additions and 21 deletions

View file

@ -875,7 +875,7 @@ steps-tests: &steps-tests
name: Run Electron tests name: Run Electron tests
environment: environment:
MOCHA_REPORTER: mocha-multi-reporters MOCHA_REPORTER: mocha-multi-reporters
MOCHA_FILE: junit/test-results.xml ELECTRON_TEST_RESULTS_DIR: junit
MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
ELECTRON_DISABLE_SECURITY_WARNINGS: 1 ELECTRON_DISABLE_SECURITY_WARNINGS: 1
command: | command: |
@ -885,15 +885,13 @@ steps-tests: &steps-tests
- run: - run:
name: Check test results existence name: Check test results existence
command: | command: |
MOCHA_FILE='src/junit/test-results-remote.xml' cd src
# Check if it exists and not empty.
if [ ! -s "$MOCHA_FILE" ]; then # Check if test results exist and are not empty.
if [ ! -s "junit/test-results-remote.xml" ]; then
exit 1 exit 1
fi fi
if [ ! -s "junit/test-results-main.xml" ]; then
MOCHA_FILE='src/junit/test-results-main.xml'
# Check if it exists and not empty.
if [ ! -s "$MOCHA_FILE" ]; then
exit 1 exit 1
fi fi
- store_test_results: - store_test_results:

View file

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