Skip to content

Commit 8fa6f29

Browse files
committed
fix tests to match two different assertion error style in node 6 and above
1 parent 6114bcd commit 8fa6f29

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

packages/jest-util/src/__tests__/buffered_console.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ describe('CustomConsole', () => {
3838
test('log the assertion error when the assertion is falsy', () => {
3939
_console.assert(false);
4040

41-
expect(stdout()).toEqual('AssertionError [ERR_ASSERTION]: false == true');
41+
expect(stdout()).toMatch('AssertionError');
42+
expect(stdout()).toMatch('false == true');
4243
});
4344

4445
test('log the assertion error when the assertion is falsy with another message argument', () => {
4546
_console.assert(false, 'ok');
4647

47-
expect(stdout()).toEqual('AssertionError [ERR_ASSERTION]: ok');
48+
expect(stdout()).toMatch('AssertionError');
49+
expect(stdout()).toMatch('ok');
4850
});
4951
});
5052

packages/jest-util/src/__tests__/console.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ describe('CustomConsole', () => {
3939
test('log the assertion error when the assertion is falsy', () => {
4040
_console.assert(false);
4141

42-
expect(_stdout).toEqual(
43-
'AssertionError [ERR_ASSERTION]: false == true\n',
44-
);
42+
expect(_stdout).toMatch('AssertionError');
43+
expect(_stdout).toMatch('false == true');
4544
});
4645

4746
test('log the assertion error when the assertion is falsy with another message argument', () => {
4847
_console.assert(false, 'ok');
4948

50-
expect(_stdout).toEqual('AssertionError [ERR_ASSERTION]: ok\n');
49+
expect(_stdout).toMatch('AssertionError');
50+
expect(_stdout).toMatch('ok');
5151
});
5252
});
5353

0 commit comments

Comments
 (0)