From 692b6b22aaf90ebbae57709bdaa8c5e500f9c185 Mon Sep 17 00:00:00 2001 From: TC Date: Fri, 1 May 2020 18:34:23 +0200 Subject: [PATCH] Enable nodeIntegration in test env (required by Spectron) --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index d146d90a..b9a7b622 100644 --- a/index.js +++ b/index.js @@ -14,6 +14,7 @@ const { store, } = require("./store"); const { fileExists, injectCSS } = require("./plugins/utils"); +const { isTesting } = require("./utils/testing"); const { setUpTray } = require("./tray"); const app = electron.app; @@ -49,7 +50,7 @@ function createMainWindow() { backgroundColor: "#000", show: false, webPreferences: { - nodeIntegration: false, + nodeIntegration: isTesting(), // Only necessary when testing with Spectron preload: path.join(__dirname, "preload.js"), nativeWindowOpen: true, // window.open return Window object(like in regular browsers), not BrowserWindowProxy affinity: "main-window", // main window, and addition windows should work in one process