Skip to content

Commit

Permalink
[New] add --no-stack option to command line
Browse files Browse the repository at this point in the history
will also look for SHOW_STACK environmental variable
  • Loading branch information
numical authored and ljharb committed May 18, 2019
1 parent f88d449 commit 8803e20
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
10 changes: 5 additions & 5 deletions bin/cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ var regexTester = require('safe-regex-test');
var jsFile = regexTester(/\.js$/i);

var argv = minimist(process.argv.slice(2));
var tap = faucet({
width: defined(argv.w, argv.width, process.stdout.isTTY
? process.stdout.columns - 5
: 0)
});
var opts = {
width: defined(argv.w, argv.width, process.stdout.isTTY ? process.stdout.columns - 5 : 0),
stack: defined(argv.stack, process.env.SHOW_STACK ? process.env.SHOW_STACK === 'true' : true)
};
var tap = faucet(opts);
process.on('exit', function (code) {
if (code === 0 && tap.exitCode !== 0) {
process.exit(tap.exitCode);
Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ module.exports = function (opts) {
test.ok = false;
}
push(out, str);
push(test.assertions, res);
if (opts.stack) {
push(test.assertions, res);
}
});

tap.on('extra', function (extra) {
Expand Down
3 changes: 2 additions & 1 deletion readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,10 @@ Once you've got a way to get TAP out of your tests, just pipe into `faucet`:

```
usage:
faucet [FILES]
faucet [FILES] [--no-stack]
command | faucet
```
* the optional ```--no-stack``` argument will remove stack traces from failed test reports

# license

Expand Down

0 comments on commit 8803e20

Please sign in to comment.