app.electron, app.webContents, etc.. undefined even if nodeIntegration is set to true
See original GitHub issueHello,
Thanks for your great work on spectron. I’m trying to setup spectron in my project but even if nodeIntegration
is set to true, app.electron
and other variables are undefined.
You can reproduce this issue in few minutes:
$ git clone https://github.com/remipassmoilesel/abc-map-2
$ cd abc-map-2
$ npm i
$ npm run test
Here is my test code:
https://github.com/remipassmoilesel/abc-map-2/blob/master/src/tests/api/handlers/MapHandlersTest.ts
And here is the electron init script:
https://github.com/remipassmoilesel/abc-map-2/blob/master/src/electron-main.ts
And if I log the application object we can see that nodeIntegration
value is set to false:
app {
"host": "127.0.0.1",
"port": 9515,
"quitTimeout": 1000,
"startTimeout": 5000,
"waitTimeout": 5000,
"connectionRetryCount": 10,
"connectionRetryTimeout": 30000,
"nodePath": "/usr/local/bin/node",
"path": "/home/remipassmoilesel/projects/abc-map-2/node_modules/electron/dist/electron",
"args": [
"/home/remipassmoilesel/projects/abc-map-2/dist/electron-main.js"
],
"chromeDriverArgs": [],
"env": {},
"workingDirectory": "/home/remipassmoilesel/projects/abc-map-2",
"requireName": "require",
"api": {
"app": "~",
"requireName": "require",
"nodeIntegration": false
},
...
What can I do to fix this ? Thanks for your help.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:10 (1 by maintainers)
Top Results From Across the Web
app.electron, app.webContents, etc.. undefined even if ...
I'm trying to setup spectron in my project but even if nodeIntegration is set to true, app.electron and other variables are undefined.
Read more >nodeIntegration true ignored? - electron - Stack Overflow
Show activity on this post. I'm trying to use a require directive in my js file attached to an html file. However, I...
Read more >BrowserWindow | Electron
If it is set to false , can not use BrowserWindow.webContents.openDevTools() to open DevTools. Default is true . nodeIntegration boolean (optional) - Whether ......
Read more >All of the Documentation | Electron - GitHub Pages
event Event ; webContents WebContents; request Object ... openAtLogin Boolean - true if the app is set to open at login. openAsHidden Boolean...
Read more >Security, Native Capabilities, and Your Responsibility | Electron
In fact, the most popular Electron apps (Atom, Slack, Visual Studio Code, etc) ... secure remote content without Node integration) – if your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Working sample with Electron 6 https://github.com/florin05/electron-spectron-example
I’m seeing this too just using the examples in the readme.