mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Don't rely on promise resolution timing in main process spec
This commit is contained in:
@@ -397,6 +397,7 @@ describe('AtomApplication', function () {
|
||||
await focusWindow(window)
|
||||
window.close()
|
||||
await window.closedPromise
|
||||
await atomApplication.lastBeforeQuitPromise
|
||||
assert(electron.app.didQuit())
|
||||
})
|
||||
} else if (process.platform === 'darwin') {
|
||||
@@ -406,6 +407,7 @@ describe('AtomApplication', function () {
|
||||
await focusWindow(window)
|
||||
window.close()
|
||||
await window.closedPromise
|
||||
await timeoutPromise(1000)
|
||||
assert(!electron.app.didQuit())
|
||||
})
|
||||
}
|
||||
@@ -495,9 +497,11 @@ describe('AtomApplication', function () {
|
||||
const window2 = atomApplication.launch(parseCommandLine([path.join(dirBPath, 'file-b')]))
|
||||
await focusWindow(window2)
|
||||
electron.app.quit()
|
||||
await new Promise(process.nextTick)
|
||||
assert(!electron.app.didQuit())
|
||||
|
||||
await Promise.all([window1.lastPrepareToUnloadPromise, window2.lastPrepareToUnloadPromise])
|
||||
await new Promise(resolve => resolve())
|
||||
await new Promise(process.nextTick)
|
||||
assert(electron.app.didQuit())
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user