juliangruber / tap-bail

Bail out when the first TAP test fails
17 stars 4 forks source link

Messes with `tape-run` #2

Open MadLittleMods opened 8 years ago

MadLittleMods commented 8 years ago

This may be more an issue with tape-run or electron but just wanted to note that tap-bail messes with running tests with tape-run.

Trying tap-bail with https://github.com/bevacqua/dragula npm test | tap-bail results in a never-ending javascript error window (keeps re-appearing after pressing ok). This can only be stopped by ps | grep electron and killing the process.

juliangruber commented 8 years ago

fixed in latest tape-run, can you give it a try?

MadLittleMods commented 8 years ago

It is much better now with tape-run@2.1.4 but not perfect.

It shows the following error after the normal output which I am guessing is something going awry with the stdout pipe or something and doesn't exit the electron process although easily exit-able in the dock now.

stream.js:74
      throw er; // Unhandled stream error in pipe.
      ^

Error: write EPIPE
    at exports._errnoException (util.js:870:11)
    at WriteWrap.afterWrite (net.js:769:14)
juliangruber commented 8 years ago

the EPIPE error indeed comes from the closed stdio, and it's node's way of exiting the problem in this case of node a.js | some-program. And since it goes to stderr, tap-bail also can't catch it.

There is however a way to fix this: Redirect your program's stderr to stdout, like so:

$ npm test 2>&1 | tap-bail

This way the output's end looks like this:

# a single time
not ok 41 (unnamed assert)
  ---
    operator: notOk
$

I'm looking into electron not closing properly

m59peacemaker commented 8 years ago

If my PR is accepted for epipebomb, you could use the cli to suppress EPIPE. https://github.com/mhart/epipebomb/pull/7

epipebomb "tape-run etc" | tap-bail
m59peacemaker commented 8 years ago

As of epipebomb@1.0.0, you can do either of these to suppress the EPIPE error.

node -r epipebomb/register node_modules/tape/bin/tape build/**/*.test.js | tap-bail

epipebomb node_modules/tape/bin/tape build/**/*.test.js | tap-bail