mantoni / mochify.js

☕️ TDD with Browserify, Mocha, Headless Chrome and WebDriver
MIT License
346 stars 57 forks source link

uncaught errors should be printed to stderr, not stdout #196

Open boneskull opened 5 years ago

boneskull commented 5 years ago

Here: https://github.com/mantoni/mochify.js/blob/master/lib/chromium.js#L141

Mochify prints uncaught errors to stdout. It should print these to stderr (which is what Mocha does).

@mantoni Any reason not to do this?

Unclear if the code at https://github.com/mantoni/mochify.js/blob/master/lib/chromium.js#L154 should also do this.

boneskull commented 5 years ago

It could be argued Mocha should print these to stdout, but that's how it works right now.

mantoni commented 5 years ago

Hmm. Can’t think of a good reason right now. I might have been lazy 😄

mantoni commented 5 years ago

There is one problem with having two output streams: The output is buffered partially to detect stack traces and map them back to the original source location using sourcemaps. Therefore it could happen that the outputs of the two streams are misleading, because there might be an offset.

boneskull commented 5 years ago

offset meaning incorrect stack trace, or do you mean interleaving? don't understand

mantoni commented 5 years ago

The one stream might be flushed while the other is still buffered. This could mean that you see a stack trace in the wrong place.

boneskull commented 5 years ago

possible to just buffer both?