Closed mweitzel closed 8 years ago
Hey Matthew, the reason I didn't merge this right away is because I'm really uneasy about this. process.exit
is a very blunt instrument, and it'd be super hard for someone to debug if they stumbled upon this by not providing a callback argument.
If anything, I'd like to change the CLI behavior to not explicitly use process.exit
, as I've even seen that eat some teenytest-scoped errors waiting to flush to stderr.
Extract cli's callback into
lib/cli/exit-on-failure
and use as default callback. This lets you call teenytest via the api with even less configuration.Where the readme suggests:
you could use defaults by invoking as
but now you can just invoke as
This may seem inconsiquential, but among other things it allows a one-liner to be added to test modules which lets them self invoke with
node my-test.js
, as well as conventionally withteenytest my-test.js
For example, a module (
foo.js
) containing the following:will still run with
teenytest foo.js
as well as standalone withnode foo