spec: Do not assume which process exits first in singleton test
This commit is contained in:
parent
696c7d59fd
commit
5940231b76
1 changed files with 9 additions and 5 deletions
|
@ -162,19 +162,23 @@ describe('app module', function () {
|
||||||
this.timeout(120000)
|
this.timeout(120000)
|
||||||
const appPath = path.join(__dirname, 'fixtures', 'api', 'singleton')
|
const appPath = path.join(__dirname, 'fixtures', 'api', 'singleton')
|
||||||
// First launch should exit with 0.
|
// First launch should exit with 0.
|
||||||
let secondLaunched = false
|
let exited = 0
|
||||||
const first = ChildProcess.spawn(remote.process.execPath, [appPath])
|
const first = ChildProcess.spawn(remote.process.execPath, [appPath])
|
||||||
first.once('exit', (code) => {
|
first.once('exit', (code) => {
|
||||||
assert.ok(secondLaunched)
|
|
||||||
assert.equal(code, 0)
|
assert.equal(code, 0)
|
||||||
done()
|
exited++
|
||||||
|
if (exited === 2) {
|
||||||
|
done()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
// Second launch should exit with 1.
|
// Second launch should exit with 1.
|
||||||
const second = ChildProcess.spawn(remote.process.execPath, [appPath])
|
const second = ChildProcess.spawn(remote.process.execPath, [appPath])
|
||||||
second.once('exit', (code) => {
|
second.once('exit', (code) => {
|
||||||
assert.ok(!secondLaunched)
|
|
||||||
assert.equal(code, 1)
|
assert.equal(code, 1)
|
||||||
secondLaunched = true
|
exited++
|
||||||
|
if (exited === 2) {
|
||||||
|
done()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue