Reuse window variable and only close from root afterEach
authorKevin Sawicki <kevinsawicki@gmail.com>
Tue, 29 Nov 2016 19:52:31 +0000 (11:52 -0800)
committerKevin Sawicki <kevinsawicki@gmail.com>
Tue, 29 Nov 2016 19:52:31 +0000 (11:52 -0800)
spec/api-session-spec.js

index f6e69808b5c8209d35b0589af1d904768666e29b..b9b6dd0a51ce9e1d04617b6939573595f2943b92 100644 (file)
@@ -236,9 +236,8 @@ describe('session module', function () {
   })
 
   describe('will-download event', function () {
-    var w = null
-
     beforeEach(function () {
+      if (w != null) w.destroy()
       w = new BrowserWindow({
         show: false,
         width: 400,
@@ -246,10 +245,6 @@ describe('session module', function () {
       })
     })
 
-    afterEach(function () {
-      return closeWindow(w).then(function () { w = null })
-    })
-
     it('can cancel default download behavior', function (done) {
       const mockFile = new Buffer(1024)
       const contentDisposition = 'inline; filename="mockFile.txt"'