I'm using node with mocha and winston. Is there a way to set it up so it only shows logs for failing tests?
Asked
Active
Viewed 6,762 times
3 Answers
16
If you run with the min reporter you will only get full output on failed tests: mocha -R min
or, if you prefer the verbose option, mocha --reporter min
.
0
As of writing (in 2022), there's now an npm package that does exactly this:
https://www.npmjs.com/package/mocha-suppress-logs
I like it because I like the output from the default mocha reporter. It keeps all that, but hides console output for succeeding tests.

verespej
- 710
- 6
- 9
-1
Possible to use
if (!expect(next.called).to.be.true) {
console.log("... further information")
}

DaveX
- 147
- 1
- 4