electron-userland / spectron

DEPRECATED: 🔎 Test Electron apps using ChromeDriver
http://electronjs.org/spectron
MIT License
1.68k stars 229 forks source link

Require is not a function.. #927

Open emersonbrambilamytoth opened 3 years ago

emersonbrambilamytoth commented 3 years ago

SO: "WINDOWS 10" NODE 14 SPECTRON 13.0.0 ELECTRON 11.4.2

ERROR: 2 | const spectron = require("spectron"); 3 | const { testWithSpectron } = require("vue-cli-plugin-electron-builder"); 4 | jest.setTimeout(50000);

Description: TypeError: require(...) is not a function

pedromoraisf commented 3 years ago

it's happening to me too

longvudai commented 3 years ago

It's also happening to me

starpit commented 3 years ago

Same. We saw this only after attempting to switch our use of node-pty from loading in the renderer process to loading in the main process; node-pty has a native (non-context-aware) module.

We have seen no such errors when loading node-pty in the renderer process (over main years and many users). But, as soon as we attempted to move our use of node-pty to the main process, spectron, on refresh(), sometimes results in require is not a function. Many tests proceed just fine, but at some point three of our tests always fail. Oddly always in the same place, which gives me some hope that this is an easy bug.

One strange thing: by removing a call in our mocha test to fs-extra.remove... a call which must occur in a process completely separate from either the main or renderer process... suddenly that one test no longer hangs on refresh. So strange.

We see it both with electron 10+spectron 12 and electron 13+spectron 15; though one of the (three) odd failures we were seeing went away with the upgrade.