Tape: Add a flag to allow console.log output to make it to the console.

Created on 22 Aug 2014  路  5Comments  路  Source: substack/tape

Often when I'm writing code I like to use my tests to get insight into the state of my code - often in preparation for writing the test itself, I will do something, inspect the state of the object, then codify the value I find as a test.

It's lo-tech, but it works, and I can't do it with tape, at the moment.

Most helpful comment

Check you're not running your tape output through some other program for pretty-rendering it. To such a program, your logging is probably indistinguishable from other TAP output.

All 5 comments

console.log output DOES make it to the console.

I'm not sure what stops it, it's not tape.

I was wondering about the same thing too - for some reason I can't get any console.log messages, not sure what I am doing wrong.

Check you're not running your tape output through some other program for pretty-rendering it. To such a program, your logging is probably indistinguishable from other TAP output.

For short messages, you could also call tape.comment to write messages out to the tap log, if you don't want to turn off your formatter.

Just make sure to turn them off when you're done if they're debug-only.

as @anko mentioned this issue can arise by using faucet or another tap processor which tend to swallow console logs. I did managed to get logs to work with colortape though

"babel-tape-runner -r src/tests/setupTests.js src/tests/**/*.js | colortape"

Was this page helpful?
0 / 5 - 0 ratings

Related issues

frankandrobot picture frankandrobot  路  4Comments

shaunlebron picture shaunlebron  路  4Comments

timbuckley picture timbuckley  路  5Comments

aral picture aral  路  8Comments

vasiliicuhar picture vasiliicuhar  路  7Comments