Skip to content

Commit 692b6b2

Browse files
committed
Enable nodeIntegration in test env (required by Spectron)
1 parent 954a58b commit 692b6b2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const {
1414
store,
1515
} = require("./store");
1616
const { fileExists, injectCSS } = require("./plugins/utils");
17+
const { isTesting } = require("./utils/testing");
1718
const { setUpTray } = require("./tray");
1819

1920
const app = electron.app;
@@ -49,7 +50,7 @@ function createMainWindow() {
4950
backgroundColor: "#000",
5051
show: false,
5152
webPreferences: {
52-
nodeIntegration: false,
53+
nodeIntegration: isTesting(), // Only necessary when testing with Spectron
5354
preload: path.join(__dirname, "preload.js"),
5455
nativeWindowOpen: true, // window.open return Window object(like in regular browsers), not BrowserWindowProxy
5556
affinity: "main-window", // main window, and addition windows should work in one process

0 commit comments

Comments
 (0)