Skip to content

Don't hide std out from tested code with base reporter #1012

Answered by isaacs
bcomnes asked this question in Q&A
Discussion options

You must be logged in to vote

That's because # this is not displayed is a valid TAP comment.

The Test Anything Protocol works by having child processes that emit data in the protocol on standard output.

If the data on stdout is not valid TAP then it is shown to the user, but all a TAP subtest actually does is emit TAP on stdout, so if your program emits TAP on stdout, well, that's going to be parsed and consumed by the runner.

For example:

// logger.js
console.log(`TAP version 14
not ok 1 - I just logged some stuff, how come the test fails?!?!
1..1`)
$ tap logger.js 
 FAIL  logger.js 1 failed of 1 491ms
 ✖ I just logged some stuff, how come the test fails?!?!

                       
  🌈 TEST COMPLETE 🌈  
            …

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@bcomnes
Comment options

@isaacs
Comment options

@Tarrask
Comment options

@isaacs
Comment options

Answer selected by isaacs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants