Friday, 9 July 2021

How to debug Unit test cases in Node

 How to debug Unit test cases in Node


1.  Add below in package.json file 


"test-debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand"


2.  go to visual studio code and press f5 then in the select node.js from  dropdown of the Debug and Run Script


3. select the debug terminal from the option 

4. type debugger; in your function 

5. open chrome new tab and enter chrome://inspect/#devices

6 . then select node dev tool

7 then press f8 to execute the code


No comments:

Post a Comment