forked from jestjs/jest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfailures.test.js.snap
More file actions
514 lines (378 loc) ยท 10.9 KB
/
failures.test.js.snap
File metadata and controls
514 lines (378 loc) ยท 10.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`not throwing Error objects 1`] = `
"FAIL __tests__/throw_number.test.js
โ Test suite failed to run
Expected an Error, but \\"1\\" was thrown
"
`;
exports[`not throwing Error objects 2`] = `
"FAIL __tests__/throw_string.test.js
โ Test suite failed to run
Error
banana
"
`;
exports[`not throwing Error objects 3`] = `
"FAIL __tests__/throw_object.test.js
โ Test suite failed to run
Error: No message was provided
"
`;
exports[`not throwing Error objects 4`] = `
"FAIL __tests__/assertion_count.test.js
.assertions()
โ throws
โ throws on redeclare of assertion count
โ throws on assertion
.hasAssertions()
โ throws when there are not assertions
โ .assertions() โบ throws
expect(received).toBeTruthy()
Expected value to be truthy, instead received
false
11 | const throws = () => {
12 | expect.assertions(2);
> 13 | expect(false).toBeTruthy();
14 | };
15 | const redeclare = () => {
16 | expect.assertions(1);
at __tests__/assertion_count.test.js:13:17
โ .assertions() โบ throws
expect.assertions(2)
Expected two assertions to be called but received one assertion call.
โ .assertions() โบ throws on redeclare of assertion count
expect(received).toBeTruthy()
Expected value to be truthy, instead received
false
15 | const redeclare = () => {
16 | expect.assertions(1);
> 17 | expect(false).toBeTruthy();
18 | expect.assertions(2);
19 | };
20 |
at __tests__/assertion_count.test.js:17:17
โ .assertions() โบ throws on assertion
expect.assertions(0)
Expected zero assertions to be called but received one assertion call.
โ .hasAssertions() โบ throws when there are not assertions
expect.hasAssertions()
Expected at least one assertion to be called but received none.
"
`;
exports[`works with assertions in separate files 1`] = `
"FAIL __tests__/test_macro.test.js
โ use some imported macro to make assertion
โ use some imported macro to make assertion
expect(received).toEqual(expected)
Expected value to equal:
2
Received:
1
10 |
11 | module.exports = (one: any, two: any) => {
> 12 | expect(one).toEqual(two);
13 | };
14 |
at macros.js:12:15
at __tests__/test_macro.test.js:14:3
"
`;
exports[`works with async failures 1`] = `
"FAIL __tests__/async_failures.test.js
โ something async
โ something async
expect(received).toEqual(expected)
Expected value to equal:
{\\"baz\\": \\"bar\\"}
Received:
{\\"foo\\": \\"bar\\"}
Difference:
- Expected
+ Received
Object {
- \\"baz\\": \\"bar\\",
+ \\"foo\\": \\"bar\\",
}
at ../../packages/expect/build/index.js:156:54
"
`;
exports[`works with node assert 1`] = `
"FAIL __tests__/node_assertion_error.test.js
โ assert
โ assert with a message
โ assert.ok
โ assert.ok with a message
โ assert.equal
โ assert.notEqual
โ assert.deepEqual
โ assert.deepEqual with a message
โ assert.notDeepEqual
โ assert.strictEqual
โ assert.notStrictEqual
โ assert.deepStrictEqual
โ assert.notDeepStrictEqual
โ assert.ifError
โ assert.doesNotThrow
โ assert.throws
โ assert
assert.equal(received, expected) or assert(received)
Expected value to be (operator: ==):
true
Received:
false
13 |
14 | test('assert', () => {
> 15 | assert(false);
16 | });
17 |
18 | test('assert with a message', () => {
at __tests__/node_assertion_error.test.js:15:3
โ assert with a message
assert.equal(received, expected) or assert(received)
Expected value to be (operator: ==):
true
Received:
false
Message:
this is a message
17 |
18 | test('assert with a message', () => {
> 19 | assert(false, 'this is a message');
20 | });
21 |
22 | test('assert.ok', () => {
at __tests__/node_assertion_error.test.js:19:3
โ assert.ok
assert.equal(received, expected) or assert(received)
Expected value to be (operator: ==):
true
Received:
false
21 |
22 | test('assert.ok', () => {
> 23 | assert.ok(false);
24 | });
25 |
26 | test('assert.ok with a message', () => {
at __tests__/node_assertion_error.test.js:23:10
โ assert.ok with a message
assert.equal(received, expected) or assert(received)
Expected value to be (operator: ==):
true
Received:
false
Message:
this is a message
25 |
26 | test('assert.ok with a message', () => {
> 27 | assert.ok(false, 'this is a message');
28 | });
29 |
30 | test('assert.equal', () => {
at __tests__/node_assertion_error.test.js:27:10
โ assert.equal
assert.equal(received, expected) or assert(received)
Expected value to be (operator: ==):
2
Received:
1
29 |
30 | test('assert.equal', () => {
> 31 | assert.equal(1, 2);
32 | });
33 |
34 | test('assert.notEqual', () => {
at __tests__/node_assertion_error.test.js:31:10
โ assert.notEqual
assert.notEqual(received, expected)
Expected value not to be (operator: !=):
1
Received:
1
Difference:
Compared values have no visual difference.
33 |
34 | test('assert.notEqual', () => {
> 35 | assert.notEqual(1, 1);
36 | });
37 |
38 | test('assert.deepEqual', () => {
at __tests__/node_assertion_error.test.js:35:10
โ assert.deepEqual
assert.deepEqual(received, expected)
Expected value to deeply equal to:
{\\"a\\": {\\"b\\": {\\"c\\": 6}}}
Received:
{\\"a\\": {\\"b\\": {\\"c\\": 5}}}
Difference:
- Expected
+ Received
Object {
\\"a\\": Object {
\\"b\\": Object {
- \\"c\\": 6,
+ \\"c\\": 5,
},
},
}
37 |
38 | test('assert.deepEqual', () => {
> 39 | assert.deepEqual({a: {b: {c: 5}}}, {a: {b: {c: 6}}});
40 | });
41 |
42 | test('assert.deepEqual with a message', () => {
at __tests__/node_assertion_error.test.js:39:10
โ assert.deepEqual with a message
assert.deepEqual(received, expected)
Expected value to deeply equal to:
{\\"a\\": {\\"b\\": {\\"c\\": 7}}}
Received:
{\\"a\\": {\\"b\\": {\\"c\\": 5}}}
Message:
this is a message
Difference:
- Expected
+ Received
Object {
\\"a\\": Object {
\\"b\\": Object {
- \\"c\\": 7,
+ \\"c\\": 5,
},
},
}
41 |
42 | test('assert.deepEqual with a message', () => {
> 43 | assert.deepEqual({a: {b: {c: 5}}}, {a: {b: {c: 7}}}, 'this is a message');
44 | });
45 |
46 | test('assert.notDeepEqual', () => {
at __tests__/node_assertion_error.test.js:43:10
โ assert.notDeepEqual
assert.notDeepEqual(received, expected)
Expected value not to deeply equal to:
{\\"a\\": 1}
Received:
{\\"a\\": 1}
Difference:
Compared values have no visual difference.
45 |
46 | test('assert.notDeepEqual', () => {
> 47 | assert.notDeepEqual({a: 1}, {a: 1});
48 | });
49 |
50 | test('assert.strictEqual', () => {
at __tests__/node_assertion_error.test.js:47:10
โ assert.strictEqual
assert.strictEqual(received, expected)
Expected value to be (operator: ===):
NaN
Received:
1
49 |
50 | test('assert.strictEqual', () => {
> 51 | assert.strictEqual(1, NaN);
52 | });
53 |
54 | test('assert.notStrictEqual', () => {
at __tests__/node_assertion_error.test.js:51:10
โ assert.notStrictEqual
assert.notStrictEqual(received, expected)
Expected value not to be (operator: !==):
1
Received:
1
Message:
My custom error message
Difference:
Compared values have no visual difference.
53 |
54 | test('assert.notStrictEqual', () => {
> 55 | assert.notStrictEqual(1, 1, 'My custom error message');
56 | });
57 |
58 | test('assert.deepStrictEqual', () => {
at __tests__/node_assertion_error.test.js:55:10
โ assert.deepStrictEqual
assert.deepStrictEqual(received, expected)
Expected value to deeply and strictly equal to:
{\\"a\\": 2}
Received:
{\\"a\\": 1}
Difference:
- Expected
+ Received
Object {
- \\"a\\": 2,
+ \\"a\\": 1,
}
57 |
58 | test('assert.deepStrictEqual', () => {
> 59 | assert.deepStrictEqual({a: 1}, {a: 2});
60 | });
61 |
62 | test('assert.notDeepStrictEqual', () => {
at __tests__/node_assertion_error.test.js:59:10
โ assert.notDeepStrictEqual
assert.notDeepStrictEqual(received, expected)
Expected value not to deeply and strictly equal to:
{\\"a\\": 1}
Received:
{\\"a\\": 1}
Difference:
Compared values have no visual difference.
61 |
62 | test('assert.notDeepStrictEqual', () => {
> 63 | assert.notDeepStrictEqual({a: 1}, {a: 1});
64 | });
65 |
66 | test('assert.ifError', () => {
at __tests__/node_assertion_error.test.js:63:10
โ assert.ifError
Error
1 thrown
โ assert.doesNotThrow
assert.doesNotThrow(function)
Expected the function not to throw an error.
Instead, it threw:
[Error: err!]
Message:
Got unwanted exception.
69 |
70 | test('assert.doesNotThrow', () => {
> 71 | assert.doesNotThrow(() => {
72 | throw Error('err!');
73 | });
74 | });
at __tests__/node_assertion_error.test.js:71:10
โ assert.throws
assert.throws(function)
Expected the function to throw an error.
But it didn't throw anything.
Message:
Missing expected exception.
75 |
76 | test('assert.throws', () => {
> 77 | assert.throws(() => {});
78 | });
79 |
at __tests__/node_assertion_error.test.js:77:10
"
`;
exports[`works with snapshot failures 1`] = `
"FAIL __tests__/snapshot.test.js
โ failing snapshot
โ failing snapshot
expect(value).toMatchSnapshot()
Received value does not match stored snapshot 1.
- \\"bar\\"
+ \\"foo\\"
10 |
11 | test('failing snapshot', () => {
> 12 | expect('foo').toMatchSnapshot();
13 | });
14 |
at __tests__/snapshot.test.js:12:17
โบ 1 snapshot test failed.
"
`;