Skip to content

Commit 1a23fe7

Browse files
committed
fix snapshot
1 parent d938ca0 commit 1a23fe7

File tree

2 files changed

+67
-25
lines changed

2 files changed

+67
-25
lines changed

e2e/__tests__/__snapshots__/failures.test.ts.snap

+67-24
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,8 @@ exports[`works with node assert 1`] = `
422422
✕ assert.ifError
423423
✕ assert.doesNotThrow
424424
✕ assert.throws
425+
✕ assert.throws with different error messages
426+
✕ assert.throws with different error types
425427
✕ async
426428
✕ assert.fail
427429
✕ assert.fail with a message
@@ -795,10 +797,51 @@ exports[`works with node assert 1`] = `
795797
| ^
796798
77 | });
797799
78 |
798-
79 | test('async', async () => {
800+
79 | test('assert.throws with different error messages', () => {
799801
800802
at Object.throws (__tests__/assertionError.test.js:76:10)
801803
804+
assert.throws with different error messages
805+
806+
assert.throws(function)
807+
808+
Expected values to be strictly deep-equal:
809+
+ actual - expected
810+
811+
Comparison {
812+
+ message: 'message 1'
813+
- message: 'message 2'
814+
}
815+
816+
78 |
817+
79 | test('assert.throws with different error messages', () => {
818+
> 80 | assert.throws(
819+
| ^
820+
81 | () => {
821+
82 | throw new Error('message 1');
822+
83 | },
823+
824+
at Object.throws (__tests__/assertionError.test.js:80:10)
825+
826+
assert.throws with different error types
827+
828+
assert.throws(function)
829+
830+
The "TypeError" validation function is expected to return "true". Received TypeError: SyntaxError: message 1
831+
832+
89 |
833+
90 | test('assert.throws with different error types', () => {
834+
> 91 | assert.throws(() => {
835+
| ^
836+
92 | throw new SyntaxError('message 1');
837+
93 | }, TypeError);
838+
94 | });
839+
840+
at Object.throws (__tests__/assertionError.test.js:91:10)
841+
Caught error:
842+
SyntaxError: message 1
843+
at Object.throws (__tests__/assertionError.test.js:91:10)
844+
802845
async
803846
804847
assert.equal(received, expected)
@@ -820,29 +863,29 @@ exports[`works with node assert 1`] = `
820863
hello
821864
+ goodbye
822865
823-
78 |
824-
79 | test('async', async () => {
825-
> 80 | assert.equal('hello\\ngoodbye', 'hello', 'hmmm');
826-
| ^
827-
81 | });
828-
82 |
829-
83 | test('assert.fail', () => {
866+
95 |
867+
96 | test('async', async () => {
868+
> 97 | assert.equal('hello\\ngoodbye', 'hello', 'hmmm');
869+
| ^
870+
98 | });
871+
99 |
872+
100 | test('assert.fail', () => {
830873
831-
at Object.equal (__tests__/assertionError.test.js:80:10)
874+
at Object.equal (__tests__/assertionError.test.js:97:10)
832875
833876
assert.fail
834877
835878
assert.fail(received, expected)
836879
837-
82 |
838-
83 | test('assert.fail', () => {
839-
> 84 | assert.fail();
840-
| ^
841-
85 | });
842-
86 |
843-
87 | test('assert.fail with a message', () => {
880+
99 |
881+
100 | test('assert.fail', () => {
882+
> 101 | assert.fail();
883+
| ^
884+
102 | });
885+
103 |
886+
104 | test('assert.fail with a message', () => {
844887
845-
at Object.fail (__tests__/assertionError.test.js:84:10)
888+
at Object.fail (__tests__/assertionError.test.js:101:10)
846889
847890
assert.fail with a message
848891
@@ -851,14 +894,14 @@ exports[`works with node assert 1`] = `
851894
Message:
852895
error!
853896
854-
86 |
855-
87 | test('assert.fail with a message', () => {
856-
> 88 | assert.fail('error!');
857-
| ^
858-
89 | });
859-
90 |
897+
103 |
898+
104 | test('assert.fail with a message', () => {
899+
> 105 | assert.fail('error!');
900+
| ^
901+
106 | });
902+
107 |
860903
861-
at Object.fail (__tests__/assertionError.test.js:88:10)"
904+
at Object.fail (__tests__/assertionError.test.js:105:10)"
862905
`;
863906
864907
exports[`works with snapshot failures 1`] = `

packages/jest-circus/src/formatNodeAssertErrors.ts

-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ function assertionErrorMessage(
151151

152152
if (operatorName === 'throws') {
153153
if (error.generatedMessage) {
154-
// Thrown error do not match expected one
155154
return (
156155
buildHintString(assertThrowingMatcherHint(operatorName)) +
157156
chalk.reset(error.message) +

0 commit comments

Comments
 (0)