From cc2936cfdf845127d7500644bb8f0e5e295b2c14 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 29 Nov 2016 12:30:40 -0800 Subject: [PATCH] closeWindow in an afterEach block --- spec/api-web-frame-spec.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/spec/api-web-frame-spec.js b/spec/api-web-frame-spec.js index 4ef6fdd38..ce0d0436e 100644 --- a/spec/api-web-frame-spec.js +++ b/spec/api-web-frame-spec.js @@ -6,6 +6,11 @@ const {BrowserWindow, protocol, ipcMain} = remote describe('webFrame module', function () { var fixtures = path.resolve(__dirname, 'fixtures') + var w = null + + afterEach(function () { + return closeWindow(w).then(function () { w = null }) + }) describe('webFrame.registerURLSchemeAsPrivileged', function () { it('supports fetch api by default', function (done) { @@ -96,14 +101,11 @@ describe('webFrame module', function () { runNumber++ const url = standardScheme + '://fake-host' - var w = new BrowserWindow({show: false}) + w = new BrowserWindow({show: false}) after(function (done) { protocol.unregisterProtocol(corsScheme, function () { protocol.unregisterProtocol(standardScheme, function () { - closeWindow(w).then(function () { - w = null - done() - }) + done() }) }) })