From e136b8d58a94b4894159fa822e81bcb9ebda670e Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Wed, 13 Feb 2019 10:16:08 +0100 Subject: [PATCH] chore: fix test for node 6 --- .../customMatcherStackTrace.test.js.snap | 16 ++++++++-------- .../__tests__/asynchronous.test.js | 9 ++++----- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/e2e/__tests__/__snapshots__/customMatcherStackTrace.test.js.snap b/e2e/__tests__/__snapshots__/customMatcherStackTrace.test.js.snap index 15df98763079..9baa065aa805 100644 --- a/e2e/__tests__/__snapshots__/customMatcherStackTrace.test.js.snap +++ b/e2e/__tests__/__snapshots__/customMatcherStackTrace.test.js.snap @@ -9,14 +9,14 @@ FAIL __tests__/asynchronous.test.js We expect the stack trace and code fence for this matcher to be shown in the console. 9 | - 10 | test('showing the stack trace for an async matcher', async () => { - > 11 | await expect(true).toThrowCustomAsyncMatcherError(); - | ^ - 12 | }); - 13 | - 14 | async function toThrowCustomAsyncMatcherError() { - - at Object.toThrowCustomAsyncMatcherError (__tests__/asynchronous.test.js:11:22) + 10 | test('showing the stack trace for an async matcher', () => + > 11 | expect(true).toThrowCustomAsyncMatcherError()); + | ^ + 12 | + 13 | function toThrowCustomAsyncMatcherError() { + 14 | const message = () => + + at Object.toThrowCustomAsyncMatcherError (__tests__/asynchronous.test.js:11:16) `; exports[`works with custom matchers 1`] = ` diff --git a/e2e/custom-matcher-stack-trace/__tests__/asynchronous.test.js b/e2e/custom-matcher-stack-trace/__tests__/asynchronous.test.js index 33061bffa53e..d989da108644 100644 --- a/e2e/custom-matcher-stack-trace/__tests__/asynchronous.test.js +++ b/e2e/custom-matcher-stack-trace/__tests__/asynchronous.test.js @@ -7,12 +7,11 @@ expect.extend({toThrowCustomAsyncMatcherError}); -test('showing the stack trace for an async matcher', async () => { - await expect(true).toThrowCustomAsyncMatcherError(); -}); +test('showing the stack trace for an async matcher', () => + expect(true).toThrowCustomAsyncMatcherError()); -async function toThrowCustomAsyncMatcherError() { +function toThrowCustomAsyncMatcherError() { const message = () => 'We expect the stack trace and code fence for this matcher to be shown in the console.'; - return {message, pass: false}; + return Promise.resolve({message, pass: false}); }