Browse Source

Merge pull request #11133 from electron/skip-tests-that-should-be-skipped

Explicitly skip tests that should be skipped
shelley vohr 7 years ago
parent
commit
c7e40a2a64

+ 100 - 28
spec/api-app-spec.js

@@ -113,8 +113,13 @@ describe('app module', () => {
   })
 
   describe('app.isInApplicationsFolder()', () => {
+    before(function () {
+      if (process.platform !== 'darwin') {
+        this.skip()
+      }
+    })
+
     it('should be false during tests', () => {
-      if (process.platform !== 'darwin') return
       assert.equal(app.isInApplicationsFolder(), false)
     })
   })
@@ -220,7 +225,11 @@ describe('app module', () => {
   })
 
   describe('app.setUserActivity(type, userInfo)', () => {
-    if (process.platform !== 'darwin') return
+    before(function () {
+      if (process.platform !== 'darwin') {
+        this.skip()
+      }
+    })
 
     it('sets the current activity', () => {
       app.setUserActivity('com.electron.testActivity', {testData: '123'})
@@ -229,10 +238,14 @@ describe('app module', () => {
   })
 
   xdescribe('app.importCertificate', () => {
-    if (process.platform !== 'linux') return
-
     var w = null
 
+    before(function () {
+      if (process.platform !== 'linux') {
+        this.skip()
+      }
+    })
+
     afterEach(() => closeWindow(w).then(() => { w = null }))
 
     it('can import certificate into platform cert store', (done) => {
@@ -310,33 +323,70 @@ describe('app module', () => {
     })
   })
 
-  describe('app.setBadgeCount API', () => {
-    const shouldFail = process.platform === 'win32' ||
-                       (process.platform === 'linux' && !app.isUnityRunning())
+  describe('app.setBadgeCount', () => {
+    const platformIsNotSupported =
+        (process.platform === 'win32') ||
+        (process.platform === 'linux' && !app.isUnityRunning())
+    const platformIsSupported = !platformIsNotSupported
 
-    afterEach(() => {
+    const expectedBadgeCount = 42
+    let returnValue = null
+
+    beforeEach(() => {
+      returnValue = app.setBadgeCount(expectedBadgeCount)
+    })
+
+    after(() => {
+      // Remove the badge.
       app.setBadgeCount(0)
     })
 
-    it('returns false when failed', () => {
-      assert.equal(app.setBadgeCount(42), !shouldFail)
+    describe('on supported platform', () => {
+      before(function () {
+        if (platformIsNotSupported) {
+          this.skip()
+        }
+      })
+
+      it('returns true', () => {
+        assert.equal(returnValue, true)
+      })
+
+      it('sets a badge count', () => {
+        assert.equal(app.getBadgeCount(), expectedBadgeCount)
+      })
     })
 
-    it('should set a badge count', () => {
-      app.setBadgeCount(42)
-      assert.equal(app.getBadgeCount(), shouldFail ? 0 : 42)
+    describe('on unsupported platform', () => {
+      before(function () {
+        if (platformIsSupported) {
+          this.skip()
+        }
+      })
+
+      it('returns false', () => {
+        assert.equal(returnValue, false)
+      })
+
+      it('does not set a badge count', () => {
+        assert.equal(app.getBadgeCount(), 0)
+      })
     })
   })
 
   describe('app.get/setLoginItemSettings API', () => {
-    if (process.platform === 'linux') return
-
     const updateExe = path.resolve(path.dirname(process.execPath), '..', 'Update.exe')
     const processStartArgs = [
       '--processStart', `"${path.basename(process.execPath)}"`,
       '--process-start-args', `"--hidden"`
     ]
 
+    before(function () {
+      if (process.platform === 'linux') {
+        this.skip()
+      }
+    })
+
     beforeEach(() => {
       app.setLoginItemSettings({openAtLogin: false})
       app.setLoginItemSettings({openAtLogin: false, path: updateExe, args: processStartArgs})
@@ -376,8 +426,12 @@ describe('app module', () => {
       })
     })
 
-    it('allows you to pass a custom executable and arguments', () => {
-      if (process.platform !== 'win32') return
+    it('allows you to pass a custom executable and arguments', function () {
+      if (process.platform !== 'win32') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return
+      }
 
       app.setLoginItemSettings({openAtLogin: true, path: updateExe, args: processStartArgs})
 
@@ -438,8 +492,6 @@ describe('app module', () => {
   })
 
   describe('setAsDefaultProtocolClient(protocol, path, args)', () => {
-    if (process.platform !== 'win32') return
-
     const protocol = 'electron-test'
     const updateExe = path.resolve(path.dirname(process.execPath), '..', 'Update.exe')
     const processStartArgs = [
@@ -447,6 +499,12 @@ describe('app module', () => {
       '--process-start-args', `"--hidden"`
     ]
 
+    before(function () {
+      if (process.platform !== 'win32') {
+        this.skip()
+      }
+    })
+
     beforeEach(() => {
       app.removeAsDefaultProtocolClient(protocol)
       app.removeAsDefaultProtocolClient(protocol, updateExe, processStartArgs)
@@ -474,9 +532,6 @@ describe('app module', () => {
   })
 
   describe('getFileIcon() API', () => {
-    // FIXME Get these specs running on Linux CI
-    if (process.platform === 'linux' && isCI) return
-
     const iconPath = path.join(__dirname, 'fixtures/assets/icon.ico')
     const sizes = {
       small: 16,
@@ -484,6 +539,15 @@ describe('app module', () => {
       large: process.platform === 'win32' ? 32 : 48
     }
 
+    // (alexeykuzmin): `.skip()` called in `before`
+    // doesn't affect nested `describe`s.
+    beforeEach(function () {
+      // FIXME Get these specs running on Linux CI
+      if (process.platform === 'linux' && isCI) {
+        this.skip()
+      }
+    })
+
     it('fetches a non-empty icon', (done) => {
       app.getFileIcon(iconPath, (err, icon) => {
         assert.equal(err, null)
@@ -523,9 +587,13 @@ describe('app module', () => {
         })
       })
 
-      it('fetches a large icon', (done) => {
+      it('fetches a large icon', function (done) {
         // macOS does not support large icons
-        if (process.platform === 'darwin') return done()
+        if (process.platform === 'darwin') {
+          // FIXME(alexeykuzmin): Skip the test.
+          // this.skip()
+          return done()
+        }
 
         app.getFileIcon(iconPath, { size: 'large' }, function (err, icon) {
           const size = icon.getSize()
@@ -572,14 +640,18 @@ describe('app module', () => {
   })
 
   describe('mixed sandbox option', () => {
-    // FIXME Get these specs running on Linux
-    if (process.platform === 'linux') return
-
     let appProcess = null
     let server = null
     const socketPath = process.platform === 'win32' ? '\\\\.\\pipe\\electron-mixed-sandbox' : '/tmp/electron-mixed-sandbox'
 
-    beforeEach((done) => {
+    beforeEach(function (done) {
+      // XXX(alexeykuzmin): Calling `.skip()` inside a `before` hook
+      // doesn't affect nested `describe`s.
+      // FIXME Get these specs running on Linux
+      if (process.platform === 'linux') {
+        this.skip()
+      }
+
       fs.unlink(socketPath, () => {
         server = net.createServer()
         server.listen(socketPath)

+ 74 - 56
spec/api-auto-updater-spec.js

@@ -2,30 +2,42 @@ const assert = require('assert')
 const {autoUpdater} = require('electron').remote
 const {ipcRenderer} = require('electron')
 
-// Skip autoUpdater tests in MAS build.
-if (!process.mas) {
-  describe('autoUpdater module', function () {
-    describe('checkForUpdates', function () {
-      it('emits an error on Windows when called the feed URL is not set', function (done) {
-        if (process.platform !== 'win32') {
-          return done()
-        }
+describe('autoUpdater module', function () {
+  // XXX(alexeykuzmin): Calling `.skip()` in a 'before' hook
+  // doesn't affect nested 'describe's
+  beforeEach(function () {
+    // Skip autoUpdater tests in MAS build.
+    if (process.mas) {
+      this.skip()
+    }
+  })
 
-        ipcRenderer.once('auto-updater-error', function (event, message) {
-          assert.equal(message, 'Update URL is not set')
-          done()
-        })
-        autoUpdater.setFeedURL('')
-        autoUpdater.checkForUpdates()
+  describe('checkForUpdates', function () {
+    it('emits an error on Windows when called the feed URL is not set', function (done) {
+      if (process.platform !== 'win32') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return done()
+      }
+
+      ipcRenderer.once('auto-updater-error', function (event, message) {
+        assert.equal(message, 'Update URL is not set')
+        done()
       })
+      autoUpdater.setFeedURL('')
+      autoUpdater.checkForUpdates()
     })
+  })
 
-    describe('setFeedURL', function () {
-      it('emits an error on macOS when the application is unsigned', function (done) {
+  describe('setFeedURL', function () {
+    describe('on Mac', function () {
+      before(function () {
         if (process.platform !== 'darwin') {
-          return done()
+          this.skip()
         }
+      })
 
+      it('emits an error when the application is unsigned', function (done) {
         ipcRenderer.once('auto-updater-error', function (event, message) {
           assert.equal(message, 'Could not get code signature for running application')
           done()
@@ -33,56 +45,62 @@ if (!process.mas) {
         autoUpdater.setFeedURL('')
       })
     })
+  })
 
-    describe('getFeedURL', function () {
-      it('returns a falsey value by default', function () {
-        assert.ok(!autoUpdater.getFeedURL())
-      })
+  describe('getFeedURL', function () {
+    it('returns a falsey value by default', function () {
+      assert.ok(!autoUpdater.getFeedURL())
+    })
 
-      it('correctly fetches the previously set FeedURL', function (done) {
-        if (process.platform !== 'win32') {
-          return done()
-        }
+    it('correctly fetches the previously set FeedURL', function (done) {
+      if (process.platform !== 'win32') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return done()
+      }
 
-        const updateURL = 'https://fake-update.electron.io'
-        autoUpdater.setFeedURL(updateURL)
-        assert.equal(autoUpdater.getFeedURL(), updateURL)
-        done()
-      })
+      const updateURL = 'https://fake-update.electron.io'
+      autoUpdater.setFeedURL(updateURL)
+      assert.equal(autoUpdater.getFeedURL(), updateURL)
+      done()
     })
+  })
 
-    describe('quitAndInstall', function () {
-      it('emits an error on Windows when no update is available', function (done) {
-        if (process.platform !== 'win32') {
-          return done()
-        }
+  describe('quitAndInstall', function () {
+    it('emits an error on Windows when no update is available', function (done) {
+      if (process.platform !== 'win32') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return done()
+      }
 
-        ipcRenderer.once('auto-updater-error', function (event, message) {
-          assert.equal(message, 'No update available, can\'t quit and install')
-          done()
-        })
-        autoUpdater.quitAndInstall()
+      ipcRenderer.once('auto-updater-error', function (event, message) {
+        assert.equal(message, 'No update available, can\'t quit and install')
+        done()
       })
+      autoUpdater.quitAndInstall()
     })
+  })
 
-    describe('error event', function () {
-      it('serializes correctly over the remote module', function (done) {
-        if (process.platform === 'linux') {
-          return done()
-        }
+  describe('error event', function () {
+    it('serializes correctly over the remote module', function (done) {
+      if (process.platform === 'linux') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return done()
+      }
 
-        autoUpdater.once('error', function (error) {
-          assert.equal(error instanceof Error, true)
-          assert.deepEqual(Object.getOwnPropertyNames(error), ['stack', 'message', 'name'])
-          done()
-        })
+      autoUpdater.once('error', function (error) {
+        assert.equal(error instanceof Error, true)
+        assert.deepEqual(Object.getOwnPropertyNames(error), ['stack', 'message', 'name'])
+        done()
+      })
 
-        autoUpdater.setFeedURL('')
+      autoUpdater.setFeedURL('')
 
-        if (process.platform === 'win32') {
-          autoUpdater.checkForUpdates()
-        }
-      })
+      if (process.platform === 'win32') {
+        autoUpdater.checkForUpdates()
+      }
     })
   })
-}
+})

+ 212 - 63
spec/api-browser-window-spec.js

@@ -338,7 +338,11 @@ describe('BrowserWindow module', () => {
   })
 
   describe('BrowserWindow.show()', () => {
-    if (isCI) return
+    before(function () {
+      if (isCI) {
+        this.skip()
+      }
+    })
 
     it('should focus on window', () => {
       w.show()
@@ -358,7 +362,11 @@ describe('BrowserWindow module', () => {
   })
 
   describe('BrowserWindow.hide()', () => {
-    if (isCI) return
+    before(function () {
+      if (isCI) {
+        this.skip()
+      }
+    })
 
     it('should defocus on window', () => {
       w.hide()
@@ -558,8 +566,15 @@ describe('BrowserWindow module', () => {
       w.setAlwaysOnTop(true)
       assert.equal(w.isAlwaysOnTop(), true)
     })
-    it('raises an error when relativeLevel is out of bounds', () => {
-      if (process.platform !== 'darwin') return
+    it('raises an error when relativeLevel is out of bounds', function () {
+      if (process.platform !== 'darwin') {
+        // FIXME(alexeykuzmin): Skip the test instead of marking it as passed.
+        // afterEach hook won't be run if a test is skipped dynamically.
+        // If afterEach isn't run current window won't be destroyed
+        // and the next test will fail on assertion in `closeWindow()`.
+        // this.skip()
+        return
+      }
 
       assert.throws(() => {
         w.setAlwaysOnTop(true, '', -2147483644)
@@ -572,7 +587,11 @@ describe('BrowserWindow module', () => {
   })
 
   describe('BrowserWindow.alwaysOnTop() resets level on minimize', () => {
-    if (process.platform !== 'darwin') return
+    before(function () {
+      if (process.platform !== 'darwin') {
+        this.skip()
+      }
+    })
 
     it('resets the windows level on minimize', () => {
       assert.equal(w.isAlwaysOnTop(), false)
@@ -586,24 +605,42 @@ describe('BrowserWindow module', () => {
   })
 
   describe('BrowserWindow.setAutoHideCursor(autoHide)', () => {
-    if (process.platform !== 'darwin') {
-      it('is not available on non-macOS platforms', () => {
-        assert.ok(!w.setAutoHideCursor)
+    describe('on macOS', () => {
+      before(function () {
+        if (process.platform !== 'darwin') {
+          this.skip()
+        }
       })
-      return
-    }
-    it('allows changing cursor auto-hiding', () => {
-      assert.doesNotThrow(() => {
-        w.setAutoHideCursor(false)
-        w.setAutoHideCursor(true)
+
+      it('allows changing cursor auto-hiding', () => {
+        assert.doesNotThrow(() => {
+          w.setAutoHideCursor(false)
+          w.setAutoHideCursor(true)
+        })
+      })
+    })
+
+    describe('on non-macOS platforms', () => {
+      before(function () {
+        if (process.platform === 'darwin') {
+          this.skip()
+        }
+      })
+
+      it('is not available', () => {
+        assert.ok(!w.setAutoHideCursor)
       })
     })
   })
 
   describe('BrowserWindow.selectPreviousTab()', () => {
-    it('does not throw', () => {
-      if (process.platform !== 'darwin') return
+    before(function () {
+      if (process.platform !== 'darwin') {
+        this.skip()
+      }
+    })
 
+    it('does not throw', () => {
       assert.doesNotThrow(() => {
         w.selectPreviousTab()
       })
@@ -611,9 +648,13 @@ describe('BrowserWindow module', () => {
   })
 
   describe('BrowserWindow.selectNextTab()', () => {
-    it('does not throw', () => {
-      if (process.platform !== 'darwin') return
+    before(function () {
+      if (process.platform !== 'darwin') {
+        this.skip()
+      }
+    })
 
+    it('does not throw', () => {
       assert.doesNotThrow(() => {
         w.selectNextTab()
       })
@@ -621,9 +662,13 @@ describe('BrowserWindow module', () => {
   })
 
   describe('BrowserWindow.mergeAllWindows()', () => {
-    it('does not throw', () => {
-      if (process.platform !== 'darwin') return
+    before(function () {
+      if (process.platform !== 'darwin') {
+        this.skip()
+      }
+    })
 
+    it('does not throw', () => {
       assert.doesNotThrow(() => {
         w.mergeAllWindows()
       })
@@ -631,9 +676,13 @@ describe('BrowserWindow module', () => {
   })
 
   describe('BrowserWindow.moveTabToNewWindow()', () => {
-    it('does not throw', () => {
-      if (process.platform !== 'darwin') return
+    before(function () {
+      if (process.platform !== 'darwin') {
+        this.skip()
+      }
+    })
 
+    it('does not throw', () => {
       assert.doesNotThrow(() => {
         w.moveTabToNewWindow()
       })
@@ -641,19 +690,28 @@ describe('BrowserWindow module', () => {
   })
 
   describe('BrowserWindow.toggleTabBar()', () => {
-    it('does not throw', () => {
-      if (process.platform !== 'darwin') return
+    before(function () {
+      if (process.platform !== 'darwin') {
+        this.skip()
+      }
+    })
 
+    it('does not throw', () => {
       assert.doesNotThrow(() => {
         w.toggleTabBar()
       })
     })
   })
 
-  describe('BrowserWindow.addTabbedWindow()', (done) => {
-    it('does not throw', () => {
-      if (process.platform !== 'darwin') return
+  // FIXME(alexeykuzmin): Fails on Mac.
+  xdescribe('BrowserWindow.addTabbedWindow()', () => {
+    before(function () {
+      if (process.platform !== 'darwin') {
+        this.skip()
+      }
+    })
 
+    it('does not throw', (done) => {
       const tabbedWindow = new BrowserWindow({})
       assert.doesNotThrow(() => {
         w.addTabbedWindow(tabbedWindow)
@@ -675,9 +733,13 @@ describe('BrowserWindow module', () => {
   })
 
   describe('BrowserWindow.setAppDetails(options)', () => {
-    it('supports setting the app details', () => {
-      if (process.platform !== 'win32') return
+    before(function () {
+      if (process.platform !== 'win32') {
+        this.skip()
+      }
+    })
 
+    it('supports setting the app details', () => {
       const iconPath = path.join(fixtures, 'assets', 'icon.ico')
 
       assert.doesNotThrow(() => {
@@ -800,8 +862,15 @@ describe('BrowserWindow module', () => {
   })
 
   describe('"titleBarStyle" option', () => {
-    if (process.platform !== 'darwin') return
-    if (parseInt(os.release().split('.')[0]) < 14) return
+    before(function () {
+      if (process.platform !== 'darwin') {
+        this.skip()
+      }
+
+      if (parseInt(os.release().split('.')[0]) < 14) {
+        this.skip()
+      }
+    })
 
     it('creates browser window with hidden title bar', () => {
       w.destroy()
@@ -828,7 +897,11 @@ describe('BrowserWindow module', () => {
   })
 
   describe('enableLargerThanScreen" option', () => {
-    if (process.platform === 'linux') return
+    before(function () {
+      if (process.platform === 'linux') {
+        this.skip()
+      }
+    })
 
     beforeEach(() => {
       w.destroy()
@@ -856,9 +929,13 @@ describe('BrowserWindow module', () => {
   })
 
   describe('"zoomToPageWidth" option', () => {
-    it('sets the window width to the page width when used', () => {
-      if (process.platform !== 'darwin') return
+    before(function () {
+      if (process.platform !== 'darwin') {
+        this.skip()
+      }
+    })
 
+    it('sets the window width to the page width when used', () => {
       w.destroy()
       w = new BrowserWindow({
         show: false,
@@ -1602,8 +1679,15 @@ describe('BrowserWindow module', () => {
 
       w.loadURL(`file://${path.join(fixtures, 'pages', 'visibilitychange.html')}`)
     })
-    it('visibilityState changes when window is shown inactive', (done) => {
-      if (isCI && process.platform === 'win32') return done()
+    it('visibilityState changes when window is shown inactive', function (done) {
+      if (isCI && process.platform === 'win32') {
+        // FIXME(alexeykuzmin): Skip the test instead of marking it as passed.
+        // afterEach hook won't be run if a test is skipped dynamically.
+        // If afterEach isn't run current window won't be destroyed
+        // and the next test will fail on assertion in `closeWindow()`.
+        // this.skip()
+        return done()
+      }
 
       w = new BrowserWindow({width: 100, height: 100})
 
@@ -1621,8 +1705,15 @@ describe('BrowserWindow module', () => {
 
       w.loadURL(`file://${path.join(fixtures, 'pages', 'visibilitychange.html')}`)
     })
-    it('visibilityState changes when window is minimized', (done) => {
-      if (isCI && process.platform === 'linux') return done()
+    it('visibilityState changes when window is minimized', function (done) {
+      if (isCI && process.platform === 'linux') {
+        // FIXME(alexeykuzmin): Skip the test instead of marking it as passed.
+        // afterEach hook won't be run if a test is skipped dynamically.
+        // If afterEach isn't run current window won't be destroyed
+        // and the next test will fail on assertion in `closeWindow()`.
+        // this.skip()
+        return done()
+      }
 
       w = new BrowserWindow({width: 100, height: 100})
 
@@ -1676,7 +1767,11 @@ describe('BrowserWindow module', () => {
   })
 
   describe('new-window event', () => {
-    if (isCI && process.platform === 'darwin') return
+    before(function () {
+      if (isCI && process.platform === 'darwin') {
+        this.skip()
+      }
+    })
 
     it('emits when window.open is called', (done) => {
       w.webContents.once('new-window', (e, url, frameName, disposition, options, additionalFeatures) => {
@@ -1743,10 +1838,14 @@ describe('BrowserWindow module', () => {
   })
 
   describe('sheet-begin event', () => {
-    if (process.platform !== 'darwin') return
-
     let sheet = null
 
+    before(function () {
+      if (process.platform !== 'darwin') {
+        this.skip()
+      }
+    })
+
     afterEach(() => {
       return closeWindow(sheet, {assertSingleWindow: false}).then(() => { sheet = null })
     })
@@ -1765,10 +1864,14 @@ describe('BrowserWindow module', () => {
   })
 
   describe('sheet-end event', () => {
-    if (process.platform !== 'darwin') return
-
     let sheet = null
 
+    before(function () {
+      if (process.platform !== 'darwin') {
+        this.skip()
+      }
+    })
+
     afterEach(() => {
       return closeWindow(sheet, {assertSingleWindow: false}).then(() => { sheet = null })
     })
@@ -1785,11 +1888,17 @@ describe('BrowserWindow module', () => {
   })
 
   describe('beginFrameSubscription method', () => {
-    // This test is too slow, only test it on CI.
-    if (!isCI) return
+    before(function () {
+      // This test is too slow, only test it on CI.
+      if (!isCI) {
+        this.skip()
+      }
 
-    // FIXME These specs crash on Linux when run in a docker container
-    if (isCI && process.platform === 'linux') return
+      // FIXME These specs crash on Linux when run in a docker container
+      if (isCI && process.platform === 'linux') {
+        this.skip()
+      }
+    })
 
     it('subscribes to frame updates', (done) => {
       let called = false
@@ -1974,8 +2083,16 @@ describe('BrowserWindow module', () => {
   })
 
   describe('window states (excluding Linux)', () => {
+    // FIXME(alexeykuzmin): Skip the tests instead of using the `return` here.
+    // Why it cannot be done now:
+    // - `.skip()` called in the 'before' hook doesn't affect
+    //     nested `describe`s.
+    // - `.skip()` called in the 'beforeEach' hook prevents 'afterEach'
+    //     hook from being called.
     // Not implemented on Linux.
-    if (process.platform === 'linux') return
+    if (process.platform === 'linux') {
+      return
+    }
 
     describe('movable state', () => {
       it('can be changed with movable option', () => {
@@ -2043,8 +2160,12 @@ describe('BrowserWindow module', () => {
     })
 
     describe('fullscreenable state', () => {
-      // Only implemented on macOS.
-      if (process.platform !== 'darwin') return
+      before(function () {
+        // Only implemented on macOS.
+        if (process.platform !== 'darwin') {
+          this.skip()
+        }
+      })
 
       it('can be changed with fullscreenable option', () => {
         w.destroy()
@@ -2062,8 +2183,12 @@ describe('BrowserWindow module', () => {
     })
 
     describe('kiosk state', () => {
-      // Only implemented on macOS.
-      if (process.platform !== 'darwin') return
+      before(function () {
+        // Only implemented on macOS.
+        if (process.platform !== 'darwin') {
+          this.skip()
+        }
+      })
 
       it('can be changed with setKiosk method', (done) => {
         w.destroy()
@@ -2082,8 +2207,12 @@ describe('BrowserWindow module', () => {
     })
 
     describe('fullscreen state with resizable set', () => {
-      // Only implemented on macOS.
-      if (process.platform !== 'darwin') return
+      before(function () {
+        // Only implemented on macOS.
+        if (process.platform !== 'darwin') {
+          this.skip()
+        }
+      })
 
       it('resizable flag should be set to true and restored', (done) => {
         w.destroy()
@@ -2101,8 +2230,12 @@ describe('BrowserWindow module', () => {
     })
 
     describe('fullscreen state', () => {
-      // Only implemented on macOS.
-      if (process.platform !== 'darwin') return
+      before(function () {
+        // Only implemented on macOS.
+        if (process.platform !== 'darwin') {
+          this.skip()
+        }
+      })
 
       it('can be changed with setFullScreen method', (done) => {
         w.destroy()
@@ -2203,8 +2336,12 @@ describe('BrowserWindow module', () => {
   })
 
   describe('BrowserWindow.setFullScreen(false)', () => {
-    // only applicable to windows: https://github.com/electron/electron/issues/6036
-    if (process.platform !== 'win32') return
+    before(function () {
+      // only applicable to windows: https://github.com/electron/electron/issues/6036
+      if (process.platform !== 'win32') {
+        this.skip()
+      }
+    })
 
     it('should restore a normal visible window from a fullscreen startup state', (done) => {
       w.webContents.once('did-finish-load', () => {
@@ -2268,7 +2405,11 @@ describe('BrowserWindow module', () => {
     })
 
     describe('win.setParentWindow(parent)', () => {
-      if (process.platform === 'win32') return
+      before(function () {
+        if (process.platform === 'win32') {
+          this.skip()
+        }
+      })
 
       beforeEach(() => {
         if (c != null) c.destroy()
@@ -2301,8 +2442,12 @@ describe('BrowserWindow module', () => {
     })
 
     describe('modal option', () => {
-      // The isEnabled API is not reliable on macOS.
-      if (process.platform === 'darwin') return
+      before(function () {
+        // The isEnabled API is not reliable on macOS.
+        if (process.platform === 'darwin') {
+          this.skip()
+        }
+      })
 
       beforeEach(() => {
         if (c != null) c.destroy()
@@ -2614,9 +2759,13 @@ describe('BrowserWindow module', () => {
   })
 
   describe('previewFile', () => {
-    it('opens the path in Quick Look on macOS', () => {
-      if (process.platform !== 'darwin') return
+    before(function () {
+      if (process.platform !== 'darwin') {
+        this.skip()
+      }
+    })
 
+    it('opens the path in Quick Look on macOS', () => {
       assert.doesNotThrow(() => {
         w.previewFile(__filename)
         w.closeFilePreview()

+ 24 - 8
spec/api-clipboard-spec.js

@@ -42,9 +42,13 @@ describe('clipboard module', () => {
   })
 
   describe('clipboard.readBookmark', () => {
-    it('returns title and url', () => {
-      if (process.platform === 'linux') return
+    before(function () {
+      if (process.platform === 'linux') {
+        this.skip()
+      }
+    })
 
+    it('returns title and url', () => {
       clipboard.writeBookmark('a title', 'https://electronjs.org')
       assert.deepEqual(clipboard.readBookmark(), {
         title: 'a title',
@@ -86,17 +90,25 @@ describe('clipboard module', () => {
   })
 
   describe('clipboard.read/writeFindText(text)', () => {
-    it('reads and write text to the find pasteboard', () => {
-      if (process.platform !== 'darwin') return
+    before(function () {
+      if (process.platform !== 'darwin') {
+        this.skip()
+      }
+    })
 
+    it('reads and write text to the find pasteboard', () => {
       clipboard.writeFindText('find this')
       assert.equal(clipboard.readFindText(), 'find this')
     })
   })
 
   describe('clipboard.writeBuffer(format, buffer)', () => {
-    it('writes a Buffer for the specified format', () => {
-      if (process.platform !== 'darwin') return
+    it('writes a Buffer for the specified format', function () {
+      if (process.platform !== 'darwin') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return
+      }
 
       const buffer = Buffer.from('writeBuffer', 'utf8')
       clipboard.writeBuffer('public.utf8-plain-text', buffer)
@@ -111,9 +123,13 @@ describe('clipboard module', () => {
   })
 
   describe('clipboard.readBuffer(format)', () => {
-    it('returns a Buffer of the content for the specified format', () => {
-      if (process.platform !== 'darwin') return
+    before(function () {
+      if (process.platform !== 'darwin') {
+        this.skip()
+      }
+    })
 
+    it('returns a Buffer of the content for the specified format', () => {
       const buffer = Buffer.from('this is binary', 'utf8')
       clipboard.writeText(buffer.toString())
       assert(buffer.equals(clipboard.readBuffer('public.utf8-plain-text')))

+ 66 - 41
spec/api-crash-reporter-spec.js

@@ -53,6 +53,7 @@ describe('crashReporter module', () => {
       })
 
       it('should send minidump when renderer crashes', function (done) {
+        // TODO(alexeykuzmin): Skip the test instead of marking it as passed.
         if (process.env.APPVEYOR === 'True') return done()
         if (process.env.TRAVIS === 'true') return done()
 
@@ -72,6 +73,7 @@ describe('crashReporter module', () => {
         })
       })
       it('should send minidump when node processes crash', function (done) {
+        // TODO(alexeykuzmin): Skip the test instead of marking it as passed.
         if (process.env.APPVEYOR === 'True') return done()
         if (process.env.TRAVIS === 'true') return done()
 
@@ -165,6 +167,7 @@ describe('crashReporter module', () => {
         })
       })
       it('should send minidump with updated extra parameters', function (done) {
+        // TODO(alexeykuzmin): Skip the test instead of marking it as passed.
         if (process.env.APPVEYOR === 'True') return done()
         if (process.env.TRAVIS === 'true') return done()
 
@@ -267,26 +270,34 @@ describe('crashReporter module', () => {
     it('throws an error when called from the renderer process', () => {
       assert.throws(() => require('electron').crashReporter.getUploadToServer())
     })
-    it('returns true when uploadToServer is set to true', () => {
-      if (process.platform === 'darwin') {
-        crashReporter.start({
-          companyName: 'Umbrella Corporation',
-          submitURL: 'http://127.0.0.1/crashes',
-          uploadToServer: true
-        })
-        assert.equal(crashReporter.getUploadToServer(), true)
+    it('returns true when uploadToServer is set to true', function () {
+      if (process.platform !== 'darwin') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return
       }
+
+      crashReporter.start({
+        companyName: 'Umbrella Corporation',
+        submitURL: 'http://127.0.0.1/crashes',
+        uploadToServer: true
+      })
+      assert.equal(crashReporter.getUploadToServer(), true)
     })
-    it('returns false when uploadToServer is set to false', () => {
-      if (process.platform === 'darwin') {
-        crashReporter.start({
-          companyName: 'Umbrella Corporation',
-          submitURL: 'http://127.0.0.1/crashes',
-          uploadToServer: true
-        })
-        crashReporter.setUploadToServer(false)
-        assert.equal(crashReporter.getUploadToServer(), false)
+    it('returns false when uploadToServer is set to false', function () {
+      if (process.platform !== 'darwin') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return
       }
+
+      crashReporter.start({
+        companyName: 'Umbrella Corporation',
+        submitURL: 'http://127.0.0.1/crashes',
+        uploadToServer: true
+      })
+      crashReporter.setUploadToServer(false)
+      assert.equal(crashReporter.getUploadToServer(), false)
     })
   })
 
@@ -294,27 +305,35 @@ describe('crashReporter module', () => {
     it('throws an error when called from the renderer process', () => {
       assert.throws(() => require('electron').crashReporter.setUploadToServer('arg'))
     })
-    it('sets uploadToServer false when called with false', () => {
-      if (process.platform === 'darwin') {
-        crashReporter.start({
-          companyName: 'Umbrella Corporation',
-          submitURL: 'http://127.0.0.1/crashes',
-          uploadToServer: true
-        })
-        crashReporter.setUploadToServer(false)
-        assert.equal(crashReporter.getUploadToServer(), false)
+    it('sets uploadToServer false when called with false', function () {
+      if (process.platform !== 'darwin') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return
       }
+
+      crashReporter.start({
+        companyName: 'Umbrella Corporation',
+        submitURL: 'http://127.0.0.1/crashes',
+        uploadToServer: true
+      })
+      crashReporter.setUploadToServer(false)
+      assert.equal(crashReporter.getUploadToServer(), false)
     })
-    it('sets uploadToServer true when called with true', () => {
-      if (process.platform === 'darwin') {
-        crashReporter.start({
-          companyName: 'Umbrella Corporation',
-          submitURL: 'http://127.0.0.1/crashes',
-          uploadToServer: false
-        })
-        crashReporter.setUploadToServer(true)
-        assert.equal(crashReporter.getUploadToServer(), true)
+    it('sets uploadToServer true when called with true', function () {
+      if (process.platform !== 'darwin') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return
       }
+
+      crashReporter.start({
+        companyName: 'Umbrella Corporation',
+        submitURL: 'http://127.0.0.1/crashes',
+        uploadToServer: false
+      })
+      crashReporter.setUploadToServer(true)
+      assert.equal(crashReporter.getUploadToServer(), true)
     })
   })
 
@@ -328,9 +347,12 @@ describe('crashReporter module', () => {
       const parameters = crashReporter.getParameters()
       assert(typeof parameters === 'object')
     })
-    it('adds a parameter to current parameters', () => {
-      // only run on MacOS
-      if (process.platform !== 'darwin') return
+    it('adds a parameter to current parameters', function () {
+      if (process.platform !== 'darwin') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return
+      }
 
       crashReporter.start({
         companyName: 'Umbrella Corporation',
@@ -340,9 +362,12 @@ describe('crashReporter module', () => {
       crashReporter.addExtraParameter('hello', 'world')
       assert('hello' in crashReporter.getParameters())
     })
-    it('removes a parameter from current parameters', () => {
-      // only run on MacOS
-      if (process.platform !== 'darwin') return
+    it('removes a parameter from current parameters', function () {
+      if (process.platform !== 'darwin') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return
+      }
 
       crashReporter.start({
         companyName: 'Umbrella Corporation',

+ 5 - 1
spec/api-desktop-capturer-spec.js

@@ -4,7 +4,11 @@ const {desktopCapturer, remote} = require('electron')
 const isCI = remote.getGlobal('isCi')
 
 describe('desktopCapturer', () => {
-  if (isCI && process.platform === 'win32') return
+  before(function () {
+    if (isCI && process.platform === 'win32') {
+      this.skip()
+    }
+  })
 
   it('should return a non-empty array of sources', (done) => {
     desktopCapturer.getSources({

+ 5 - 1
spec/api-global-shortcut-spec.js

@@ -4,7 +4,11 @@ const assert = require('assert')
 const isCI = require('electron').remote.getGlobal('isCi')
 
 describe('globalShortcut module', () => {
-  if (isCI && process.platform === 'win32') return
+  before(function () {
+    if (isCI && process.platform === 'win32') {
+      this.skip()
+    }
+  })
 
   beforeEach(() => {
     globalShortcut.unregisterAll()

+ 30 - 10
spec/api-native-image-spec.js

@@ -296,8 +296,12 @@ describe('nativeImage module', () => {
       expect(image.getSize()).to.deep.equal({width: 538, height: 190})
     })
 
-    it('Gets an NSImage pointer on macOS', () => {
-      if (process.platform !== 'darwin') return
+    it('Gets an NSImage pointer on macOS', function () {
+      if (process.platform !== 'darwin') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return
+      }
 
       const imagePath = `${path.join(__dirname, 'fixtures', 'api')}${path.sep}..${path.sep}${path.join('assets', 'logo.png')}`
       const image = nativeImage.createFromPath(imagePath)
@@ -310,8 +314,12 @@ describe('nativeImage module', () => {
       expect(allBytesAreNotNull)
     })
 
-    it('loads images from .ico files on Windows', () => {
-      if (process.platform !== 'win32') return
+    it('loads images from .ico files on Windows', function () {
+      if (process.platform !== 'win32') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return
+      }
 
       const imagePath = path.join(__dirname, 'fixtures', 'assets', 'icon.ico')
       const image = nativeImage.createFromPath(imagePath)
@@ -326,22 +334,34 @@ describe('nativeImage module', () => {
       expect(image.isEmpty())
     })
 
-    it('returns empty on non-darwin platforms', () => {
-      if (process.platform === 'darwin') return
+    it('returns empty on non-darwin platforms', function () {
+      if (process.platform === 'darwin') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return
+      }
 
       const image = nativeImage.createFromNamedImage('NSActionTemplate')
       expect(image.isEmpty())
     })
 
-    it('returns a valid image on darwin', () => {
-      if (process.platform !== 'darwin') return
+    it('returns a valid image on darwin', function () {
+      if (process.platform !== 'darwin') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return
+      }
 
       const image = nativeImage.createFromNamedImage('NSActionTemplate')
       expect(image.isEmpty()).to.be.false
     })
 
-    it('returns allows an HSL shift for a valid image on darwin', () => {
-      if (process.platform !== 'darwin') return
+    it('returns allows an HSL shift for a valid image on darwin', function () {
+      if (process.platform !== 'darwin') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return
+      }
 
       const image = nativeImage.createFromNamedImage('NSActionTemplate', [0.5, 0.2, 0.8])
       expect(image.isEmpty()).to.be.false

+ 6 - 2
spec/api-process-spec.js

@@ -10,9 +10,13 @@ describe('process module', () => {
   })
 
   describe('process.getIOCounters()', () => {
-    it('returns an io counters object', () => {
-      if (process.platform === 'darwin') return
+    before(function () {
+      if (process.platform === 'darwin') {
+        this.skip()
+      }
+    })
 
+    it('returns an io counters object', () => {
       const ioCounters = process.getIOCounters()
       assert.equal(typeof ioCounters.readOperationCount, 'number')
       assert.equal(typeof ioCounters.writeOperationCount, 'number')

+ 7 - 2
spec/api-protocol-spec.js

@@ -682,8 +682,13 @@ describe('protocol module', () => {
       })
     })
 
-    it('sends error when callback is called with nothing', (done) => {
-      if (process.env.TRAVIS === 'true') return done()
+    it('sends error when callback is called with nothing', function (done) {
+      if (process.env.TRAVIS === 'true') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return done()
+      }
+
       protocol.interceptBufferProtocol('http', emptyHandler, (error) => {
         if (error) return done(error)
         $.ajax({

+ 5 - 1
spec/api-screen-spec.js

@@ -20,7 +20,11 @@ describe('screen module', () => {
   })
 
   describe('screen.getMenuBarHeight()', () => {
-    if (process.platform !== 'darwin') return
+    before(function () {
+      if (process.platform !== 'darwin') {
+        this.skip()
+      }
+    })
 
     it('returns an integer', () => {
       const screenHeight = screen.getMenuBarHeight()

+ 6 - 2
spec/api-session-spec.js

@@ -357,8 +357,12 @@ describe('session module', () => {
       })
     })
 
-    it('can generate a default filename', (done) => {
-      if (process.env.APPVEYOR === 'True') return done()
+    it('can generate a default filename', function (done) {
+      if (process.env.APPVEYOR === 'True') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return done()
+      }
 
       downloadServer.listen(0, '127.0.0.1', () => {
         const port = downloadServer.address().port

+ 7 - 2
spec/api-shell-spec.js

@@ -5,8 +5,6 @@ const os = require('os')
 const {shell} = require('electron')
 
 describe('shell module', () => {
-  if (process.platform !== 'win32') return
-
   const fixtures = path.resolve(__dirname, 'fixtures')
   const shortcutOptions = {
     target: 'C:\\target',
@@ -18,6 +16,13 @@ describe('shell module', () => {
     iconIndex: 1
   }
 
+  // (alexeykuzmin): `.skip()` in `before` doesn't work for nested `describe`s.
+  beforeEach(function () {
+    if (process.platform !== 'win32') {
+      this.skip()
+    }
+  })
+
   describe('shell.readShortcutLink(shortcutPath)', () => {
     it('throws when failed', () => {
       assert.throws(() => {

+ 26 - 8
spec/api-system-preferences-spec.js

@@ -4,7 +4,11 @@ const {systemPreferences} = remote
 
 describe('systemPreferences module', () => {
   describe('systemPreferences.getAccentColor', () => {
-    if (process.platform !== 'win32') return
+    before(function () {
+      if (process.platform !== 'win32') {
+        this.skip()
+      }
+    })
 
     it('should return a non-empty string', () => {
       let accentColor = systemPreferences.getAccentColor()
@@ -14,7 +18,11 @@ describe('systemPreferences module', () => {
   })
 
   describe('systemPreferences.getColor(id)', () => {
-    if (process.platform !== 'win32') return
+    before(function () {
+      if (process.platform !== 'win32') {
+        this.skip()
+      }
+    })
 
     it('throws an error when the id is invalid', () => {
       assert.throws(() => {
@@ -28,9 +36,11 @@ describe('systemPreferences module', () => {
   })
 
   describe('systemPreferences.getUserDefault(key, type)', () => {
-    if (process.platform !== 'darwin') {
-      return
-    }
+    before(function () {
+      if (process.platform !== 'darwin') {
+        this.skip()
+      }
+    })
 
     it('returns values for known user defaults', () => {
       const locale = systemPreferences.getUserDefault('AppleLocale', 'string')
@@ -56,8 +66,6 @@ describe('systemPreferences module', () => {
   })
 
   describe('systemPreferences.setUserDefault(key, type, value)', () => {
-    if (process.platform !== 'darwin') return
-
     const KEY = 'SystemPreferencesTest'
     const TEST_CASES = [
       ['string', 'abc'],
@@ -70,6 +78,12 @@ describe('systemPreferences module', () => {
       ['dictionary', {'a': 1, 'b': 2}]
     ]
 
+    before(function () {
+      if (process.platform !== 'darwin') {
+        this.skip()
+      }
+    })
+
     it('sets values', () => {
       for (const [type, value] of TEST_CASES) {
         systemPreferences.setUserDefault(KEY, type, value)
@@ -94,7 +108,11 @@ describe('systemPreferences module', () => {
   })
 
   describe('systemPreferences.setUserDefault(key, type, value)', () => {
-    if (process.platform !== 'darwin') return
+    before(function () {
+      if (process.platform !== 'darwin') {
+        this.skip()
+      }
+    })
 
     it('removes keys', () => {
       const KEY = 'SystemPreferencesTest'

+ 6 - 3
spec/asar-spec.js

@@ -658,13 +658,16 @@ describe('asar package', function () {
 
     describe('child_process.execFile', function () {
       var echo, execFile, execFileSync
-      if (process.platform !== 'darwin') {
-        return
-      }
       execFile = ChildProcess.execFile
       execFileSync = ChildProcess.execFileSync
       echo = path.join(fixtures, 'asar', 'echo.asar', 'echo')
 
+      before(function () {
+        if (process.platform !== 'darwin') {
+          this.skip()
+        }
+      })
+
       it('executes binaries', function (done) {
         execFile(echo, ['test'], function (error, stdout) {
           assert.equal(error, null)

+ 22 - 5
spec/chromium-spec.js

@@ -26,8 +26,13 @@ describe('chromium feature', () => {
   afterEach(() => closeWindow(w).then(() => { w = null }))
 
   describe('heap snapshot', () => {
-    it('does not crash', () => {
-      if (process.env.TRAVIS === 'true') return
+    it('does not crash', function () {
+      if (process.env.TRAVIS === 'true') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return
+      }
+
       process.atomBinding('v8_util').takeHeapSnapshot()
     })
   })
@@ -165,7 +170,11 @@ describe('chromium feature', () => {
   })
 
   describe('window.open', () => {
-    if (process.env.TRAVIS === 'true' && process.platform === 'darwin') return
+    before(function () {
+      if (process.env.TRAVIS === 'true' && process.platform === 'darwin') {
+        this.skip()
+      }
+    })
 
     it('returns a BrowserWindowProxy object', () => {
       const b = window.open('about:blank', '', 'show=no')
@@ -666,10 +675,18 @@ describe('chromium feature', () => {
   })
 
   describe('webgl', () => {
-    if (isCI && process.platform === 'win32') return
+    before(function () {
+      if (isCI && process.platform === 'win32') {
+        this.skip()
+      }
+    })
 
     it('can be get as context in canvas', () => {
-      if (process.platform === 'linux') return
+      if (process.platform === 'linux') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return
+      }
 
       const webgl = document.createElement('canvas').getContext('webgl')
       assert.notEqual(webgl, null)

+ 5 - 2
spec/modules-spec.js

@@ -29,8 +29,11 @@ describe('modules support', () => {
     })
 
     describe('ffi', () => {
-      if (!nativeModulesEnabled) return
-      if (process.platform === 'win32') return
+      before(function () {
+        if (!nativeModulesEnabled || process.platform === 'win32') {
+          this.skip()
+        }
+      })
 
       it('does not crash', () => {
         const ffi = require('ffi')

+ 26 - 8
spec/node-spec.js

@@ -153,7 +153,11 @@ describe('node feature', () => {
 
   describe('contexts', () => {
     describe('setTimeout in fs callback', () => {
-      if (process.env.TRAVIS === 'true') return
+      before(function () {
+        if (process.env.TRAVIS === 'true') {
+          this.skip()
+        }
+      })
 
       it('does not crash', (done) => {
         fs.readFile(__filename, () => {
@@ -245,7 +249,11 @@ describe('node feature', () => {
   })
 
   describe('net.connect', () => {
-    if (process.platform !== 'darwin') return
+    before(function () {
+      if (process.platform !== 'darwin') {
+        this.skip()
+      }
+    })
 
     it('emit error when connect to a socket path without listeners', (done) => {
       const socketPath = path.join(os.tmpdir(), 'atom-shell-test.sock')
@@ -300,14 +308,24 @@ describe('node feature', () => {
       })
     })
 
-    it('should have isTTY defined on Mac and Linux', () => {
-      if (isCI) return
+    it('should have isTTY defined on Mac and Linux', function () {
+      if (isCI || process.platform === 'win32') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return
+      }
+
+      assert.equal(typeof process.stdout.isTTY, 'boolean')
+    })
 
-      if (process.platform === 'win32') {
-        assert.equal(process.stdout.isTTY, undefined)
-      } else {
-        assert.equal(typeof process.stdout.isTTY, 'boolean')
+    it('should have isTTY undefined on Windows', function () {
+      if (isCI || process.platform !== 'win32') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return
       }
+
+      assert.equal(process.stdout.isTTY, undefined)
     })
   })
 

+ 34 - 10
spec/webview-spec.js

@@ -137,9 +137,13 @@ describe('<webview> tag', function () {
       document.body.appendChild(webview)
     })
 
-    it('loads node symbols after POST navigation when set', (done) => {
+    it('loads node symbols after POST navigation when set', function (done) {
       // FIXME Figure out why this is timing out on AppVeyor
-      if (process.env.APPVEYOR === 'True') return done()
+      if (process.env.APPVEYOR === 'True') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return done()
+      }
 
       webview.addEventListener('console-message', (e) => {
         assert.equal(e.message, 'function object object')
@@ -409,7 +413,11 @@ describe('<webview> tag', function () {
   })
 
   describe('allowpopups attribute', () => {
-    if (process.env.TRAVIS === 'true' && process.platform === 'darwin') return
+    before(function () {
+      if (process.env.TRAVIS === 'true' && process.platform === 'darwin') {
+        this.skip()
+      }
+    })
 
     it('can not open new window when not set', (done) => {
       const listener = (e) => {
@@ -495,7 +503,11 @@ describe('<webview> tag', function () {
   })
 
   describe('new-window event', () => {
-    if (process.env.TRAVIS === 'true' && process.platform === 'darwin') return
+    before(function () {
+      if (process.env.TRAVIS === 'true' && process.platform === 'darwin') {
+        this.skip()
+      }
+    })
 
     it('emits when window.open is called', (done) => {
       webview.addEventListener('new-window', (e) => {
@@ -824,8 +836,12 @@ describe('<webview> tag', function () {
   })
 
   describe('executeJavaScript', () => {
-    it('should support user gesture', (done) => {
-      if (process.env.TRAVIS !== 'true' || process.platform === 'darwin') return done()
+    it('should support user gesture', function (done) {
+      if (process.env.TRAVIS !== 'true' || process.platform === 'darwin') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return done()
+      }
 
       const listener = () => {
         webview.removeEventListener('enter-html-full-screen', listener)
@@ -842,8 +858,12 @@ describe('<webview> tag', function () {
       document.body.appendChild(webview)
     })
 
-    it('can return the result of the executed script', (done) => {
-      if (process.env.TRAVIS === 'true' && process.platform === 'darwin') return done()
+    it('can return the result of the executed script', function (done) {
+      if (process.env.TRAVIS === 'true' && process.platform === 'darwin') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return done()
+      }
 
       const listener = () => {
         const jsScript = "'4'+2"
@@ -1550,8 +1570,12 @@ describe('<webview> tag', function () {
       })
     })
 
-    it('can be manually resized with setSize even when attribute is present', done => {
-      if (process.env.TRAVIS === 'true') return done()
+    it('can be manually resized with setSize even when attribute is present', function (done) {
+      if (process.env.TRAVIS === 'true') {
+        // FIXME(alexeykuzmin): Skip the test.
+        // this.skip()
+        return done()
+      }
 
       w = new BrowserWindow({show: false, width: 200, height: 200})
       w.loadURL(`file://${fixtures}/pages/webview-no-guest-resize.html`)