test: move crashReporter specs to the main process (#20417)

This commit is contained in:
Jeremy Apthorp 2019-10-14 14:38:54 -07:00 committed by GitHub
parent eb100cdf9e
commit 8dad0c7aaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 476 additions and 447 deletions

View file

@ -91,7 +91,7 @@ app.whenReady().then(() => {
walker.on('end', () => {
testFiles.sort()
testFiles.forEach((file) => mocha.addFile(file))
sortToEnd(testFiles, f => f.includes('crash-reporter')).forEach((file) => mocha.addFile(file))
const cb = () => {
// Ensure the callback is called after runner is defined
process.nextTick(() => {
@ -101,3 +101,15 @@ app.whenReady().then(() => {
const runner = mocha.run(cb)
})
})
function partition (xs, f) {
const trues = []
const falses = []
xs.forEach(x => (f(x) ? trues : falses).push(x))
return [trues, falses]
}
function sortToEnd (xs, f) {
const [end, beginning] = partition(xs, f)
return beginning.concat(end)
}