From d410d534707d67725929fb771fc2eddb74e67ce1 Mon Sep 17 00:00:00 2001 From: Don Schrimsher Date: Mon, 21 Jan 2019 20:02:29 -0500 Subject: [PATCH] Use wrap in e2e test for custom matcher stack trace Uses the new wrap utility in e2e snapshot for custom matcher stack traces. --- .../customMatcherStackTrace.test.js.snap | 16 ++-------------- e2e/__tests__/customMatcherStackTrace.test.js | 4 ++-- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/e2e/__tests__/__snapshots__/customMatcherStackTrace.test.js.snap b/e2e/__tests__/__snapshots__/customMatcherStackTrace.test.js.snap index 4a6b5758e60d..d88de254fe71 100644 --- a/e2e/__tests__/__snapshots__/customMatcherStackTrace.test.js.snap +++ b/e2e/__tests__/__snapshots__/customMatcherStackTrace.test.js.snap @@ -1,8 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`custom async matchers 1`] = ` -Object { - "rest": "FAIL __tests__/async.test.js +FAIL __tests__/async.test.js ✕ showing the stack trace for an async matcher ● showing the stack trace for an async matcher @@ -18,19 +17,10 @@ Object { 7 | async function toThrowCustomAsyncMatcherError() { at Object.toThrowCustomAsyncMatcherError (__tests__/async.test.js:4:22) - -", - "summary": "Test Suites: 1 failed, 1 total -Tests: 1 failed, 1 total -Snapshots: 0 total -Time: <> -Ran all test suites matching /async.test.js/i. -", -} `; exports[`works with custom matchers 1`] = ` -"FAIL __tests__/async.test.js +FAIL __tests__/async.test.js ● showing the stack trace for an async matcher We expect the stack trace and code fence for this matcher to be shown in the console. @@ -64,6 +54,4 @@ FAIL __tests__/sync.test.js at foo (__tests__/sync.test.js:52:7) at Object.callback (__tests__/sync.test.js:11:18) at Object.toCustomMatch (__tests__/sync.test.js:53:8) - -" `; diff --git a/e2e/__tests__/customMatcherStackTrace.test.js b/e2e/__tests__/customMatcherStackTrace.test.js index a4a8971d72b4..0912a65d8abb 100644 --- a/e2e/__tests__/customMatcherStackTrace.test.js +++ b/e2e/__tests__/customMatcherStackTrace.test.js @@ -27,7 +27,7 @@ test('works with custom matchers', () => { test('custom async matchers', () => { const {stderr} = runJest('custom-matcher-stack-trace', ['async.test.js']); - const result = extractSummary(stderr); + const {rest} = extractSummary(stderr); - expect(result).toMatchSnapshot(); + expect(wrap(rest)).toMatchSnapshot(); });