Tape: Changing stream output

Created on 24 Apr 2018  路  7Comments  路  Source: substack/tape

Every example of Tape test failures seems to output to the terminal like this..

    TAP version 13
    # timing test
    ok 1 should be equal
    not ok 2 should be equal
    ---
    operator: equal
    expected: 100
    actual:   107
    ...

    1..2
    # tests 2
    # pass  1
    # fail  1

Whereas my output to the terminal contain the stack & at properties, and excludes the test, pass, fail summary at the end of the output, see below..

    TAP version 13
    # timing test
    ok 1 should be equal
    not ok 2 should be equal
    ---
    operator: equal
    expected: 100
    actual:   107
    at: request.get.expect.expect (server.test.js:12:14)
    stack: |-
       Error: should be equal
         at Test.assert
         at Test.bound
         // etc

How can I change the stream so that my outputs to the terminal exclude the stack & at properties, and include the test, pass, fail summary?

Most helpful comment

Isn't that the concern of a reporter? A custom reporter could format the results however it likes, including suppressing any extra information.

You're absolutely right. This is one of those times when you come back to an issue and can't believe you have so easily come around to disagree with your opinion from only two months ago.

All 7 comments

I would also like to exclude the long and entirely useless stack trace from my output. From half an hour of searching, the only solution I've found is to create a custom reporter (and the only such reporters I've found also omit other important information).

Can I ask why you'd want to omit this information? If the test fails, the stack info helps to debug - and tests sometimes fail spuriously, so it seems like a big loss to discard that information just to hope that it will be there when you're debugging.

That makes sense for when you run tests before comitting. But if you're already in the debugging process, you don't need to see the huge stack track over and over. I'm changing code and I want to see which tests are failing. I already know _where_.

Isn't that the concern of a reporter? A custom reporter could format the results however it likes, including suppressing any extra information.

@ivanjonas @ljharb I think your discussion on whether the stack trace should or should not exist has distracted from a large problem (which admittedly was listed as an afterthought) ... the fact that the summary output is lost. I'm seeing this behavior with a number of reporters as well.

EDIT: Unless I set up a custom harness ... then things work as expected.

@planttheidea aha, thanks.

The summary shouldn't be lost with a stream when there's a failure. A PR with a failing test case, and better, also with a fix, would be very appreciated.

Isn't that the concern of a reporter? A custom reporter could format the results however it likes, including suppressing any extra information.

You're absolutely right. This is one of those times when you come back to an issue and can't believe you have so easily come around to disagree with your opinion from only two months ago.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jimkang picture jimkang  路  3Comments

mustafamamun picture mustafamamun  路  3Comments

AndyOGo picture AndyOGo  路  8Comments

callumlocke picture callumlocke  路  4Comments

javajosh picture javajosh  路  5Comments