nx-electron icon indicating copy to clipboard operation
nx-electron copied to clipboard

Testing steps (seem) to be wrong

Open Suyashtnt opened this issue 2 years ago • 3 comments

Describe the bug I'm trying to test an angular app that uses ngx-electron, so I would assume that the test command template would work, but it doesnt

To Reproduce Steps to reproduce the behavior:

  1. Initalize nx workspace using angular
  2. add ngx-electron 2.1 yarn add ngx-electron 2.2 import NgxElectronModule from it and add it into your app modules import 2.3 create a service with tests 2.4 inject ElectronService
  3. add an electron app using this that points to the angular project
  4. run nx run-many --target=test --projects=<frontend-app>,<electron-app> --parallel
  5. See error

Expected behavior It runs the electron app and works

Screenshots image

Desktop (please complete the following information):

  • OS: Windows 11 Insider build
  • Nx Electron Version 11.1.3

Additional context If you need code I can provide I repo soon:tm:

Suyashtnt avatar Aug 04 '21 06:08 Suyashtnt

Ok So I figured out why that error occurs(forgot to import and inject when testing) but it seems that ipcRenderer is null when testing, even though it works perfectly fine normally

image

Suyashtnt avatar Aug 04 '21 06:08 Suyashtnt

Hi, I think you need to run inside an electron app in order that the ipc renderer will be initialized. So you can just test it just on the frontend.

bennymeg avatar Aug 05 '21 20:08 bennymeg

Hi, I think you need to run inside an electron app in order that the ipc renderer will be initialized. So you can just test it just on the frontend.

yes, but how?

Suyashtnt avatar Aug 06 '21 06:08 Suyashtnt