How to debug Jest unit test on Expo app?

#1

I have an Expo project (generated by exp init) and Jest unit tests (configured via jest-expo).

In Jest docs, they say:

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

node --inspect-brk node_modules/.bin/jest --runInBand

That’s exactly what I do, the debugger; gets hit, but there is a problem with all the variables. See the example below, everywhere in devtools it ways it is undefined (when I hover over it), but when I access it via the console below - it is there!

issue 1

Same issue with all variables. When I log them in the console - they are okay. Any suggestions how I can solve this?

I’m running on MacOS, Chrome 65.0, NodeJS v9.8.0, Expo SDK 25.0.0.


Note: I cross-posted this question on StackOverflow, however, I didn’t get much exposure, that’s why I decided to post in this forum too. I hope somebody can help!

#2

Does this also happen with a non-Expo project using Jest?

closed #3

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.