From 216971c48376522180cf63c2f8cc8c528a35baa4 Mon Sep 17 00:00:00 2001 From: Yen-Chi Chen Date: Thu, 23 Apr 2020 21:36:32 +0200 Subject: [PATCH] wrap snapshot --- .../__snapshots__/messages.test.ts.snap | 22 +++++++++---------- .../src/__tests__/messages.test.ts | 7 +++--- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/packages/jest-message-util/src/__tests__/__snapshots__/messages.test.ts.snap b/packages/jest-message-util/src/__tests__/__snapshots__/messages.test.ts.snap index 99256df0436c..864ec781fc8a 100644 --- a/packages/jest-message-util/src/__tests__/__snapshots__/messages.test.ts.snap +++ b/packages/jest-message-util/src/__tests__/__snapshots__/messages.test.ts.snap @@ -36,24 +36,24 @@ exports[`formatStackTrace should strip node internals 1`] = ` `; exports[`getConsoleOutput does not print code frame when noCodeFrame = true 1`] = ` -" - at Object. (file.js:1:7) - " + + at Object. (file.js:1:7) + `; exports[`getConsoleOutput does not print codeframe when noStackTrace = true 1`] = ` -" - at Object. (file.js:1:7) - " + + at Object. (file.js:1:7) + `; exports[`getConsoleOutput prints code frame and stacktrace 1`] = ` -" - > 1 | throw new Error(\\"Whoops!\\"); - | ^ - at Object. (file.js:1:7) - " + > 1 | throw new Error("Whoops!"); +   |  ^ + + at Object. (file.js:1:7) + `; exports[`no codeframe 1`] = ` diff --git a/packages/jest-message-util/src/__tests__/messages.test.ts b/packages/jest-message-util/src/__tests__/messages.test.ts index e4b3d3bf8dad..de463d93dffe 100644 --- a/packages/jest-message-util/src/__tests__/messages.test.ts +++ b/packages/jest-message-util/src/__tests__/messages.test.ts @@ -9,6 +9,7 @@ import {readFileSync} from 'fs'; import slash = require('slash'); import tempy = require('tempy'); +import {wrap} from 'jest-snapshot-serializer-raw'; import {formatExecError, formatResultsErrors, formatStackTrace} from '..'; const rootDir = tempy.directory(); @@ -313,7 +314,7 @@ describe('getConsoleOutput', () => { 'path_test', ); - expect(message).toMatchSnapshot(); + expect(wrap(message)).toMatchSnapshot(); }); it('does not print code frame when noCodeFrame = true', () => { @@ -338,7 +339,7 @@ describe('getConsoleOutput', () => { 'path_test', ); - expect(message).toMatchSnapshot(); + expect(wrap(message)).toMatchSnapshot(); }); it('does not print codeframe when noStackTrace = true', () => { @@ -362,6 +363,6 @@ describe('getConsoleOutput', () => { 'path_test', ); - expect(message).toMatchSnapshot(); + expect(wrap(message)).toMatchSnapshot(); }); });