Browse Source

Fix afterEach

Ryohei Ikegami 8 years ago
parent
commit
c77e07bc15
1 changed files with 6 additions and 4 deletions
  1. 6 4
      spec/modules-spec.js

+ 6 - 4
spec/modules-spec.js

@@ -4,6 +4,7 @@ const path = require('path')
 const temp = require('temp')
 const {remote} = require('electron')
 const {BrowserWindow} = remote
+const {closeWindow} = require('./window-helpers')
 
 describe('third-party module', function () {
   var fixtures = path.join(__dirname, 'fixtures')
@@ -142,14 +143,15 @@ describe('require', () => {
       })
     })
 
+    afterEach(async () => {
+      await closeWindow(w)
+      w = null
+    })
+
     it('searches for module under app directory', async () => {
       w.loadURL('about:blank')
       const result = await w.webContents.executeJavaScript('typeof require("q").when')
       assert.equal(result, 'function')
     })
-
-    afterEach(() => {
-      w.destroy()
-    })
   })
 })