build: ensure runner is defined inside the spec callback (#17664)
This commit is contained in:
parent
dc4fe537ee
commit
59e3164206
2 changed files with 26 additions and 20 deletions
|
@ -75,16 +75,19 @@ app.whenReady().then(() => {
|
||||||
|
|
||||||
walker.on('end', () => {
|
walker.on('end', () => {
|
||||||
const runner = mocha.run(() => {
|
const runner = mocha.run(() => {
|
||||||
if (isCi && runner.hasOnly) {
|
// Ensure the callback is called after runner is defined
|
||||||
try {
|
process.nextTick(() => {
|
||||||
throw new Error('A spec contains a call to it.only or describe.only and should be reverted.')
|
if (isCi && runner.hasOnly) {
|
||||||
} catch (error) {
|
try {
|
||||||
console.error(error.stack || error)
|
throw new Error('A spec contains a call to it.only or describe.only and should be reverted.')
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error.stack || error)
|
||||||
|
}
|
||||||
|
process.exit(1)
|
||||||
}
|
}
|
||||||
process.exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
process.exit(runner.failures)
|
process.exit(runner.failures)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -94,21 +94,24 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const runner = mocha.run(() => {
|
const runner = mocha.run(() => {
|
||||||
if (isCi && runner.hasOnly) {
|
// Ensure the callback is called after runner is defined
|
||||||
try {
|
setTimeout(() => {
|
||||||
throw new Error('A spec contains a call to it.only or describe.only and should be reverted.')
|
if (isCi && runner.hasOnly) {
|
||||||
} catch (error) {
|
try {
|
||||||
console.error(error.stack || error)
|
throw new Error('A spec contains a call to it.only or describe.only and should be reverted.')
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error.stack || error)
|
||||||
|
}
|
||||||
|
ipcRenderer.send('process.exit', 1)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
ipcRenderer.send('process.exit', 1)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
Mocha.utils.highlightTags('code')
|
Mocha.utils.highlightTags('code')
|
||||||
|
|
||||||
if (isCi) {
|
if (isCi) {
|
||||||
ipcRenderer.send('process.exit', runner.failures)
|
ipcRenderer.send('process.exit', runner.failures)
|
||||||
}
|
}
|
||||||
|
}, 0)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})()
|
})()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue