fix remote setInterval flake (#12263)

This commit is contained in:
Samuel Attard 2018-03-14 14:51:47 +09:00 committed by GitHub
parent e7181eb89c
commit 9ed9885c8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -184,11 +184,15 @@ describe('node feature', () => {
describe('setInterval called under Chromium event loop in browser process', () => {
it('can be scheduled in time', (done) => {
let interval = null
let clearing = false
const clear = () => {
if (interval === null) {
if (interval === null || clearing) {
return
}
// interval might trigger while clearing (remote is slow sometimes)
clearing = true
remote.getGlobal('clearInterval')(interval)
clearing = false
interval = null
done()
}