build: speedy tests on circle by splitting the test files into multiple jobs (#21015)

* build: let circleci divide our test suites in two

* well our tests rely on side affects, thats cool I guess
This commit is contained in:
Samuel Attard 2019-11-06 16:15:55 -08:00 committed by GitHub
parent bbfb32b136
commit 24939e8fa4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 51 additions and 80 deletions

View file

@ -43,6 +43,7 @@ app.whenReady().then(() => {
const argv = require('yargs')
.boolean('ci')
.array('files')
.string('g').alias('g', 'grep')
.boolean('i').alias('i', 'invert')
.argv
@ -86,15 +87,27 @@ app.whenReady().then(() => {
}
})
const baseElectronDir = path.resolve(__dirname, '..')
walker.on('end', () => {
testFiles.sort()
sortToEnd(testFiles, f => f.includes('crash-reporter')).forEach((file) => mocha.addFile(file))
sortToEnd(testFiles, f => f.includes('crash-reporter')).forEach((file) => {
if (!argv.files || argv.files.includes(path.relative(baseElectronDir, file))) {
mocha.addFile(file)
}
})
const cb = () => {
// Ensure the callback is called after runner is defined
process.nextTick(() => {
process.exit(runner.failures)
})
}
// Set up chai in the correct order
const chai = require('chai')
chai.use(require('chai-as-promised'))
chai.use(require('dirty-chai'))
const runner = mocha.run(cb)
})
})