From what I know console.log()
should work without problem printing to the STDOUT of my console, when running a script.
But in my case I have NPM configured to run Jest when issuing npm test
from the shell, and any console.log()
inside the test files doesn't print anything on the screen.
I tried also to use process.stdout.write()
but still I get no custom output when running npm test
.
How am I supposed to debug stuff in my test scripts? I can't figure out if it is a problem from Node, from NPM, or from Jest. There's a Jest issue that looks similar to mine but still I cannot solve and get to output a simple string; while there rest of Jest output is echoed as usual.
Anybody experienced a similar problem?
EDIT 1:
I tried running npm test -- --runInBand
but the log doesn't appear.
Note
trying to run the command repeatedly like
console.log('foo...');console.log('bar..');console.log('baz..');
I can sometimes see the log, but this is then overwritten/hidden by the rest of the following Jest output.