Robinfr / electron-react-typescript

Electron boilerplate with React, Redux, and TypeScript
MIT License
432 stars 85 forks source link

Do I need to start-renderer-dev before runnning e2e tests? #12

Closed zxch3n closed 5 years ago

zxch3n commented 5 years ago

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

zxch3n commented 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.

zxch3n commented 5 years ago

OK. I get it now. I should use the production build before the e2e test.