Closed zxch3n closed 5 years ago
I found that process.env.NODE_ENV
will be compiled to a raw string after webpack. The above code will be compiled to
if (true) {
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = '1';
win.loadURL(`http://localhost:2003`);
} else { }
So setting new Application({env: {NODE_ENV: 'test'}})
won't help.
OK. I get it now. I should use the production build before the e2e test.
If the renderer-dev had not started before the e2e tests, the window wouldn't be rendered.
I'm not sure whether it's related to this part.
https://github.com/Robinfr/electron-react-typescript/blob/6e0012eef9649520b5a84075e629c82a29dcb0d3/src/main/main.ts#L24-L35