[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
12

Configure Feed

Select the types of activity you want to include in your feed.

feat: don't show diff in snapshot message (#99)

Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>

authored by

Tony Gorez
Anthony Fu
and committed by
GitHub
(Dec 13, 2021, 4:32 PM +0800) 1cb38cdf 2091f9fb

+8 -5
+1
src/reporters/error.ts
··· 85 85 86 86 function printErrorMessage(error: ErrorWithDiff) { 87 87 const errorName = error.name || error.nameStr || 'Unknown Error' 88 + 88 89 console.error(c.red(`${c.bold(errorName)}: ${error.message}`)) 89 90 } 90 91
+7 -5
src/integrations/snapshot/client.ts
··· 62 62 }) 63 63 64 64 if (!pass) { 65 - // improve log 66 - expect(actual.trim()).equals( 67 - expected ? expected.trim() : '', 68 - message || `Snapshot name: \`${key}\``, 69 - ) 65 + try { 66 + expect(actual.trim()).equals(expected ? expected.trim() : '') 67 + } 68 + catch (error: any) { 69 + error.message = `Snapshot \`${key || 'unknown'}\` mismatched` 70 + throw error 71 + } 70 72 } 71 73 } 72 74