From ef53dc6d2febf71c0ace5426dda455bfe93ee10f Mon Sep 17 00:00:00 2001 From: Ran Yitzhaki Date: Thu, 15 Feb 2018 18:15:19 +0200 Subject: [PATCH] fix tests to match two different assertion error style in node 6 and above --- packages/jest-util/src/__tests__/buffered_console.test.js | 6 ++++-- packages/jest-util/src/__tests__/console.test.js | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/jest-util/src/__tests__/buffered_console.test.js b/packages/jest-util/src/__tests__/buffered_console.test.js index f76b6de5e9f7..103b9091a81b 100644 --- a/packages/jest-util/src/__tests__/buffered_console.test.js +++ b/packages/jest-util/src/__tests__/buffered_console.test.js @@ -38,13 +38,15 @@ describe('CustomConsole', () => { test('log the assertion error when the assertion is falsy', () => { _console.assert(false); - expect(stdout()).toEqual('AssertionError [ERR_ASSERTION]: false == true'); + expect(stdout()).toMatch('AssertionError'); + expect(stdout()).toMatch('false == true'); }); test('log the assertion error when the assertion is falsy with another message argument', () => { _console.assert(false, 'ok'); - expect(stdout()).toEqual('AssertionError [ERR_ASSERTION]: ok'); + expect(stdout()).toMatch('AssertionError'); + expect(stdout()).toMatch('ok'); }); }); diff --git a/packages/jest-util/src/__tests__/console.test.js b/packages/jest-util/src/__tests__/console.test.js index 9a635732d4cb..4502f8ac32f6 100644 --- a/packages/jest-util/src/__tests__/console.test.js +++ b/packages/jest-util/src/__tests__/console.test.js @@ -39,15 +39,15 @@ describe('CustomConsole', () => { test('log the assertion error when the assertion is falsy', () => { _console.assert(false); - expect(_stdout).toEqual( - 'AssertionError [ERR_ASSERTION]: false == true\n', - ); + expect(_stdout).toMatch('AssertionError'); + expect(_stdout).toMatch('false == true'); }); test('log the assertion error when the assertion is falsy with another message argument', () => { _console.assert(false, 'ok'); - expect(_stdout).toEqual('AssertionError [ERR_ASSERTION]: ok\n'); + expect(_stdout).toMatch('AssertionError'); + expect(_stdout).toMatch('ok'); }); });