1

I am trying to auto generate unit test code for angular 8 using ngentest library. But when i tried to change the default configuration from jest to karma, even when i changed in ngentest.config.js file of the ngentest module or i copy pasted ngentest.config.js file to root folder of angular or even to the same folder of component where i am trying to generate test case.

framework: 'karma', // or 'jest'

In all cases, when i tried to generate code, it generates in same jest test case. Any would be appreciated.

skyboyer
  • 22,209
  • 7
  • 57
  • 64
RK6
  • 424
  • 1
  • 5
  • 23

2 Answers2

1

For a fix, since I installed ngentest as global (npm install - g ngentest). I edited global ngentest module, configuration file—ngentest.config.js. Then, I uncommented the following line:

framework: 'karma', // or 'jest'

For finding global npm modules, just press the Windows button and type %APPDATA% and then hit Enter. Above is the location where you can find the \npm\node_modules folder. This is where global modules sit in your system.

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
RK6
  • 424
  • 1
  • 5
  • 23
1

Below commands worked for me :

ngentest app-header.component.ts --framework='jest'
ngentest app-header.component.ts --framework='karma'

We need to pass the framework value as a command line argument

Note: app-header.component.ts is the complete path of the component