Browse Source

test: attempt at fixing flaky takeHeapSnapshotTest (#15881)

ref #15095
trop[bot] 6 years ago
parent
commit
8b37e62717
1 changed files with 4 additions and 2 deletions
  1. 4 2
      spec/api-web-contents-spec.js

+ 4 - 2
spec/api-web-contents-spec.js

@@ -878,8 +878,9 @@ describe('webContents module', () => {
         }
       })
 
+      const p = emittedOnce(w.webContents, 'did-finish-load')
       w.loadURL('about:blank')
-      await emittedOnce(w.webContents, 'did-finish-load')
+      await p
 
       const filePath = path.join(remote.app.getPath('temp'), 'test.heapsnapshot')
 
@@ -909,8 +910,9 @@ describe('webContents module', () => {
         }
       })
 
+      const p = emittedOnce(w.webContents, 'did-finish-load')
       w.loadURL('about:blank')
-      await emittedOnce(w.webContents, 'did-finish-load')
+      await p
 
       const promise = w.webContents.takeHeapSnapshot('')
       return expect(promise).to.be.eventually.rejectedWith(Error, 'takeHeapSnapshot failed')