Skip to content

Commit

Permalink
fix: show diff for errors that contain actual/expected without showDi…
Browse files Browse the repository at this point in the history
…ff (#1966)
  • Loading branch information
IgnusG committed Sep 4, 2022
1 parent aa7eb7d commit c8afc01
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/vitest/src/node/error.ts
Expand Up @@ -69,7 +69,8 @@ export async function printError(error: unknown, ctx: Vitest, options: PrintErro

handleImportOutsideModuleError(e.stack || e.stackStr || '', ctx)

if (e.showDiff) {
// Eg. AssertionError from assert does not set showDiff but has both actual and expected properties
if (e.showDiff || (e.showDiff === undefined && e.actual && e.expected)) {
displayDiff(stringify(e.actual), stringify(e.expected), ctx.logger.console, {
outputTruncateLength: ctx.config.outputTruncateLength,
outputDiffLines: ctx.config.outputDiffLines,
Expand Down

0 comments on commit c8afc01

Please sign in to comment.