Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const DefaultReporter = require('jest-cli/build/reporters/default_reporter').default;
/**
* The purpose of this custom reporter is to prevent Jest from logging to stderr
* when there are no errors.
*/
class JestReporter extends DefaultReporter {
constructor(...args) {
super(...args);
this._isLoggingError = false;
this.log = message => {
if (this._isLoggingError) {
process.stderr.write(message + '\n');
} else {
process.stdout.write(message + '\n');
}