From the linked issue since the problem is going on since years…
There is a pull request in the alpha release that is going to fix this problem. Looks like the last refining is being worked in the past few hours (see Github issue link).
However I found a solution that works for my simplest case:
- just run enabling verbose mode and the log will magically appear!
npm test -- --verbose=true
This will not fix in every case; maybe async/multi-thread/etc will still have problems (please report your experiences, so I can update the answer); fo r example adding a process.exit(1) after the log will hide it again.
Trying to press ctrl + c before the process.exit() runs (with the right timing…) will show that the log is actually there and being overridden.
I will update the answer with news, but probably this will help others in starting with Node/NPM/Jest setups!
Jest’s GitHub issue mention some useful details/suggestions:
- https://github.com/facebook/jest/issues/2441#issuecomment-713433790
- https://github.com/facebook/jest/issues/2441#issuecomment-724131782
- https://github.com/facebook/jest/issues/2441#issuecomment-586359238
- https://github.com/facebook/jest/issues/2441#issuecomment-611122871
- https://github.com/facebook/jest/issues/2441#issuecomment-623856169
- aaaand…. https://github.com/facebook/jest/issues/2441#issuecomment-649391333
Jest replaces the global console module; this apparently is the source of the issue. And also the fact that Jest will set it to true automatically if you’re running a single test. upside_down_face