diff --git a/SilentReporter.js b/SilentReporter.js index ed1fa46..c1c0398 100644 --- a/SilentReporter.js +++ b/SilentReporter.js @@ -7,7 +7,8 @@ class SilentReporter { this._globalConfig = globalConfig; this.stdio = new StdIo(); this.useDots = !!process.env.JEST_SILENT_REPORTER_DOTS || !!options.useDots; - this.showPaths = !!process.env.JEST_SILENT_REPORTER_SHOW_PATHS || !!options.showPaths; + this.showPaths = + !!process.env.JEST_SILENT_REPORTER_SHOW_PATHS || !!options.showPaths; this.showWarnings = !!process.env.JEST_SILENT_REPORTER_SHOW_WARNINGS || !!options.showWarnings; @@ -32,17 +33,30 @@ class SilentReporter { } if (!testResult.skipped) { - if (testResult.failureMessage) { - if (this.showPaths) this.stdio.log('\n' + test.path); - this.stdio.log('\n' + testResult.failureMessage); + const didUpdate = this._globalConfig.updateSnapshot === 'all'; + let hasSnapshotFailures = false; + if (testResult.snapshot) { + if (!didUpdate && testResult.snapshot.unchecked) { + hasSnapshotFailures = true; + } + if (testResult.snapshot.unmatched) { + hasSnapshotFailures = true; + } } + + const hasFailures = testResult.failureMessage || hasSnapshotFailures; + + if (this.showPaths && hasFailures) { + this.stdio.log('\n' + test.path); + } + if (testResult.failureMessage) + this.stdio.log('\n' + testResult.failureMessage); if (testResult.console && this.showWarnings) { testResult.console .filter(entry => entry.type === 'warn' && entry.message) .map(entry => entry.message) .forEach(this.stdio.log); } - const didUpdate = this._globalConfig.updateSnapshot === 'all'; const snapshotStatuses = helpers.getSnapshotStatus( testResult.snapshot, didUpdate