Comments (5)
This is likely caused by the same issue in #40. We need to wrap all files to provide the proper paths for require
and module.paths
to load against
https://github.com/twolfson/karma-electron/blob/6.1.1/lib/node-integration-iframe.mustache.js#L36
Please see README for setting up preprocessors
and client.useIframe
https://github.com/twolfson/karma-electron/tree/6.1.1#getting-started
from karma-electron.
First of all, thanks for your great work on issue #40.
I migrated the test project to version 6.3.0 and added preprocessors
and client.useIframe
as you suggested. However, I'm still experiencing the same problem.
You can review all my changes to a default Angular installation here: https://github.com/Jusonex/karma-electron-testapp/compare/ddbab1e...master
I also added a require("sqlite3")
line that demonstrates the problem in a more practical manner. Since sqlite3
contains native modules, it has to be loaded as webpack external.
You can reproduce the problem by just running npm test
and opening the dev tools.
from karma-electron.
Okay, let's start from the beginning to I fully understand the issue
What is the behavior you're seeing on launch? Are tests running? What's the expected behavior?
from karma-electron.
What is the behavior you're seeing on launch?
21 06 2019 10:01:44.822:INFO [karma-server]: Karma v4.0.1 server started at http://0.0.0.0:9876/
21 06 2019 10:01:44.823:INFO [launcher]: Launching browsers CustomElectron with concurrency unlimited
karma-electron: `--show` is now deprecated. Please use `browserWindowOptions.show` instead
21 06 2019 10:01:44.832:INFO [launcher]: Starting browser Electron
21 06 2019 10:01:49.666:WARN [karma]: No captured browser, open http://localhost:9876/
21 06 2019 10:01:49.985:INFO [Electron 5.0.4 (Node 12.0.0)]: Connected on socket CdMl_yYqQ550D6QAAAAA with id 18121251
Electron 5.0.4 (Node 12.0.0) ERROR
{
"message": "Uncaught Error: Cannot find module 'sqlite3'\nRequire stack:\n- C:\\Dev\\karma-electron-repro\\testapp\\node_modules\\electron\\dist\\resources\\electron.asar\\renderer\\init.js\nat internal/modules/cjs/loader.js:662:5\n\nundefined",
"str": "Uncaught Error: Cannot find module 'sqlite3'\nRequire stack:\n- C:\\Dev\\karma-electron-repro\\testapp\\node_modules\\electron\\dist\\resources\\electron.asar\\renderer\\init.js\nat internal/modules/cjs/loader.js:662:5\n\nundefined"
}
Are tests running?
No, because it errors before tests are executed.
What's the expected behavior?
I expect the error message to not appear and tests run successfully. In ng serve
/webpack-dev-server
mode, using modules from the node_modules
folder works perfectly fine (assuming webpack externals are set up correctly, but that's unrelated to this issue).
from karma-electron.
Ah, okay. It sounds like that could be us but it could also be a configuration error or a missing plugin
The repo has too much content for me to quickly and easily verify that the issue is karma-electron
. Can you create a minimal version which only has karma-electron
, your testing framework (e.g. jasmine
), and is reproducing the error?
from karma-electron.
Related Issues (20)
- `electron` did show not nothing happen then HOT 1
- Can't import nodejs modules in an angular-cli project (Typescript) HOT 1
- Errors without stack traces coming from karma-electron? HOT 5
- running with ndb for debugging? HOT 2
- Unable to open Electron window using --show HOT 3
- Electron 5 nodeIntegration HOT 12
- Custom launcher `require` mechanism doesn't work HOT 4
- Error: Karma plugin is meant to be used from within Angular CLI and will not work correctly outside of it HOT 1
- How to configure NODE_PATH for the Electron instance? HOT 24
- [feature] option like 'require', but for renderer processes. HOT 1
- Karma times out when using Electron 9 and client.useIframe = false HOT 20
- Non-context aware native modules in renderer will cause specs to error HOT 3
- [questions] Is Electron 12 supported? HOT 16
- electron V12.0.4---------require is not defined HOT 3
- ES Modules HOT 2
- "require is not defined" after update to karma-electron 7 / electron 12 HOT 12
- Regardless of the `browserWindowOptions.show` value, a window always opens. HOT 12
- sqlite3 stalls with nodeIntegration true contextIsolation false HOT 12
- Consider migrating this great work to @web/test-runner. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from karma-electron.