Closed zhouchangQ closed 3 years ago
Some more gymnastics is required to get Electron@12 working. Please see the README. If that doesn't work, feel free to re-open this issue:
https://github.com/twolfson/karma-electron/tree/7.0.0#breaking-changes-with-electron12
Thanks, When I use version 7.0.0,With or without the following configurations,It doesn't work。
customLaunchers: { CustomElectron: { base: 'Electron', browserWindowOptions: { webPreferences: { nodeIntegration: true, contextIsolation: false } } }, }
But version 6.3.4 is runable.
Can you confirm that the CustomElectron
launcher is actually being used? (e.g. no --browsers
conflicting with it, specified as browsers
in karma.conf.js
)
Hi,I have a very strange problem. karma-electron Version 7.0.0 and electron V12.0.4 I used, If I don't directly introduce methods like require,It works fine. such as:
export default { name: 'landing-page', data() { return { path: require('path'), } } }
But just introduce it at the beginning. such as:<script> require('path') export default { name: 'landing-page', data() { return { // path: require('path'), } } } </script>
An error is reported when the test is performed08 05 2021 16:50:10.794:INFO [karma]: Karma v2.0.5 server started at http://0.0.0.0:9876/ 08 05 2021 16:50:10.796:INFO [launcher]: Launching browser visibleElectron with unlimited concurrency 08 05 2021 16:50:10.800:INFO [launcher]: Starting browser Electron 08 05 2021 16:50:11.565:INFO [Electron 6.1.7 (Node 12.4.0)]: Connected on socket OKH0FmaGEa_pPhrtAAAA with id 29265082 Electron 6.1.7 (Node 12.4.0) ERROR { "message": "Uncaught ReferenceError: require is not defined\nat webpack:///external%20%22path%22:1 <- index.js:7:150137\n\nReferenceError: require is not defined\n at Object.<anonymous> (webpack:///external%20%22path%22:1 <- index.js:7:150137)\n at E (webpack:///webpack/bootstrap:789:21 <- index.js:1:7843)\n at r (webpack:///webpack/bootstrap:100:11 <- index.js:1:559)\n at Object.<anonymous> (webpack:///src/renderer/components/LandingPage.vue:33 <- index.js:7:128227)\n at E (webpack:///webpack/bootstrap:789:21 <- index.js:1:7843)\n at r (webpack:///webpack/bootstrap:100:11 <- index.js:1:559)\n at Module.<anonymous> (webpack:///src/renderer/components/LandingPage.vue?a2c6:1 <- index.js:7:124036)\n at E (webpack:///webpack/bootstrap:789:21 <- index.js:1:7843)\n at r (webpack:///webpack/bootstrap:100:11 <- index.js:1:559)\n at Module.<anonymous> (webpack:///src/renderer/components/LandingPage.vue:1 <- index.js:7:121858)", "str": "Uncaught ReferenceError: require is not defined\nat webpack:///external%20%22path%22:1 <- index.js:7:150137\n\nReferenceError: require is not defined\n at Object.<anonymous> (webpack:///external%20%22path%22:1 <- index.js:7:150137)\n at E (webpack:///webpack/bootstrap:789:21 <- index.js:1:7843)\n at r (webpack:///webpack/bootstrap:100:11 <- index.js:1:559)\n at Object.<anonymous> (webpack:///src/renderer/components/LandingPage.vue:33 <- index.js:7:128227)\n at E (webpack:///webpack/bootstrap:789:21 <- index.js:1:7843)\n at r (webpack:///webpack/bootstrap:100:11 <- index.js:1:559)\n at Module.<anonymous> (webpack:///src/renderer/components/LandingPage.vue?a2c6:1 <- index.js:7:124036)\n at E (webpack:///webpack/bootstrap:789:21 <- index.js:1:7843)\n at r (webpack:///webpack/bootstrap:100:11 <- index.js:1:559)\n at Module.<anonymous> (webpack:///src/renderer/components/LandingPage.vue:1 <- index.js:7:121858)" }
Can you help me see what the problem is? Thank you very much.