Troubleshooting

Troubleshooting

Uh oh, something went wrong? Use this guide to resolve issues with Jest.

Tests are Failing and You Don't Know Why

Try using the debugging support built into Node.

Place a debugger; statement in any of your tests, and then, in your project's directory, run:

node --debug-brk ./node_modules/.bin/jest --runInBand [any other arguments here]

This will run Jest in a Node process that an external debugger can connect to. Note that the process will pause until the debugger has connected to it.

For example, to connect the Node Inspector debugger to the paused process, you would first install it (if you don't have it installed already):

登录查看完整内容