mirror of
https://github.com/hanzoai/jest.git
synced 2026-09-24 16:59:57 +00:00
237 lines
6.3 KiB
Plaintext
237 lines
6.3 KiB
Plaintext
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
|
|
exports[`fails because of unhandled promise rejection in afterAll hook 1`] = `
|
|
Object {
|
|
"rest": "FAIL __tests__/unhandledRejectionAfterAll.test.js
|
|
|
|
|
|
● Test suite failed to run
|
|
|
|
REJECTED
|
|
|
|
11 |
|
|
12 | afterAll(async () => {
|
|
> 13 | Promise.reject(new Error('REJECTED'));
|
|
| ^
|
|
14 |
|
|
15 | await promisify(setTimeout)(0);
|
|
16 | });
|
|
|
|
at Object.<anonymous> (__tests__/unhandledRejectionAfterAll.test.js:13:18)",
|
|
"summary": "Test Suites: 1 failed, 1 total
|
|
Tests: 1 passed, 1 total
|
|
Snapshots: 0 total
|
|
Time: <<REPLACED>>
|
|
Ran all test suites matching unhandledRejectionAfterAll.test.js.",
|
|
}
|
|
`;
|
|
|
|
exports[`fails because of unhandled promise rejection in afterEach hook 1`] = `
|
|
Object {
|
|
"rest": "FAIL __tests__/unhandledRejectionAfterEach.test.js
|
|
✕ foo #1
|
|
✕ foo #2
|
|
|
|
● foo #1
|
|
|
|
REJECTED
|
|
|
|
11 |
|
|
12 | afterEach(async () => {
|
|
> 13 | Promise.reject(new Error('REJECTED'));
|
|
| ^
|
|
14 |
|
|
15 | await promisify(setTimeout)(0);
|
|
16 | });
|
|
|
|
at Object.<anonymous> (__tests__/unhandledRejectionAfterEach.test.js:13:18)
|
|
|
|
● foo #2
|
|
|
|
REJECTED
|
|
|
|
11 |
|
|
12 | afterEach(async () => {
|
|
> 13 | Promise.reject(new Error('REJECTED'));
|
|
| ^
|
|
14 |
|
|
15 | await promisify(setTimeout)(0);
|
|
16 | });
|
|
|
|
at Object.<anonymous> (__tests__/unhandledRejectionAfterEach.test.js:13:18)",
|
|
"summary": "Test Suites: 1 failed, 1 total
|
|
Tests: 2 failed, 2 total
|
|
Snapshots: 0 total
|
|
Time: <<REPLACED>>
|
|
Ran all test suites matching unhandledRejectionAfterEach.test.js.",
|
|
}
|
|
`;
|
|
|
|
exports[`fails because of unhandled promise rejection in beforeAll hook 1`] = `
|
|
Object {
|
|
"rest": "FAIL __tests__/unhandledRejectionBeforeAll.test.js
|
|
✕ foo
|
|
|
|
● foo
|
|
|
|
REJECTED
|
|
|
|
11 |
|
|
12 | beforeAll(async () => {
|
|
> 13 | Promise.reject(new Error('REJECTED'));
|
|
| ^
|
|
14 |
|
|
15 | await promisify(setTimeout)(0);
|
|
16 | });
|
|
|
|
at Object.<anonymous> (__tests__/unhandledRejectionBeforeAll.test.js:13:18)",
|
|
"summary": "Test Suites: 1 failed, 1 total
|
|
Tests: 1 failed, 1 total
|
|
Snapshots: 0 total
|
|
Time: <<REPLACED>>
|
|
Ran all test suites matching unhandledRejectionBeforeAll.test.js.",
|
|
}
|
|
`;
|
|
|
|
exports[`fails because of unhandled promise rejection in beforeEach hook 1`] = `
|
|
Object {
|
|
"rest": "FAIL __tests__/unhandledRejectionBeforeEach.test.js
|
|
✕ foo #1
|
|
✕ foo #2
|
|
|
|
● foo #1
|
|
|
|
REJECTED
|
|
|
|
11 |
|
|
12 | beforeEach(async () => {
|
|
> 13 | Promise.reject(new Error('REJECTED'));
|
|
| ^
|
|
14 |
|
|
15 | await promisify(setTimeout)(0);
|
|
16 | });
|
|
|
|
at Object.<anonymous> (__tests__/unhandledRejectionBeforeEach.test.js:13:18)
|
|
|
|
● foo #2
|
|
|
|
REJECTED
|
|
|
|
11 |
|
|
12 | beforeEach(async () => {
|
|
> 13 | Promise.reject(new Error('REJECTED'));
|
|
| ^
|
|
14 |
|
|
15 | await promisify(setTimeout)(0);
|
|
16 | });
|
|
|
|
at Object.<anonymous> (__tests__/unhandledRejectionBeforeEach.test.js:13:18)",
|
|
"summary": "Test Suites: 1 failed, 1 total
|
|
Tests: 2 failed, 2 total
|
|
Snapshots: 0 total
|
|
Time: <<REPLACED>>
|
|
Ran all test suites matching unhandledRejectionBeforeEach.test.js.",
|
|
}
|
|
`;
|
|
|
|
exports[`fails because of unhandled promise rejection in test 1`] = `
|
|
Object {
|
|
"rest": "FAIL __tests__/unhandledRejectionTest.test.js
|
|
✕ w/o event loop turn after rejection
|
|
✕ w/ event loop turn after rejection in async function
|
|
✕ w/ event loop turn after rejection in sync function
|
|
✕ combined w/ another failure _after_ promise rejection
|
|
|
|
● w/o event loop turn after rejection
|
|
|
|
REJECTED
|
|
|
|
11 |
|
|
12 | test('w/o event loop turn after rejection', () => {
|
|
> 13 | Promise.reject(new Error('REJECTED'));
|
|
| ^
|
|
14 | });
|
|
15 |
|
|
16 | test('w/ event loop turn after rejection in async function', async () => {
|
|
|
|
at Object.<anonymous> (__tests__/unhandledRejectionTest.test.js:13:18)
|
|
|
|
● w/ event loop turn after rejection in async function
|
|
|
|
REJECTED
|
|
|
|
15 |
|
|
16 | test('w/ event loop turn after rejection in async function', async () => {
|
|
> 17 | Promise.reject(new Error('REJECTED'));
|
|
| ^
|
|
18 |
|
|
19 | await promisify(setTimeout)(0);
|
|
20 | });
|
|
|
|
at Object.<anonymous> (__tests__/unhandledRejectionTest.test.js:17:18)
|
|
|
|
● w/ event loop turn after rejection in sync function
|
|
|
|
REJECTED
|
|
|
|
21 |
|
|
22 | test('w/ event loop turn after rejection in sync function', done => {
|
|
> 23 | Promise.reject(new Error('REJECTED'));
|
|
| ^
|
|
24 |
|
|
25 | setTimeout(done, 0);
|
|
26 | });
|
|
|
|
at Object.<anonymous> (__tests__/unhandledRejectionTest.test.js:23:18)
|
|
|
|
● combined w/ another failure _after_ promise rejection
|
|
|
|
expect(received).toBe(expected) // Object.is equality
|
|
|
|
Expected: false
|
|
Received: true
|
|
|
|
31 | await promisify(setTimeout)(0);
|
|
32 |
|
|
> 33 | expect(true).toBe(false);
|
|
| ^
|
|
34 | });
|
|
35 |
|
|
|
|
at Object.toBe (__tests__/unhandledRejectionTest.test.js:33:16)
|
|
|
|
● combined w/ another failure _after_ promise rejection
|
|
|
|
REJECTED
|
|
|
|
27 |
|
|
28 | test('combined w/ another failure _after_ promise rejection', async () => {
|
|
> 29 | Promise.reject(new Error('REJECTED'));
|
|
| ^
|
|
30 |
|
|
31 | await promisify(setTimeout)(0);
|
|
32 |
|
|
|
|
at Object.<anonymous> (__tests__/unhandledRejectionTest.test.js:29:18)",
|
|
"summary": "Test Suites: 1 failed, 1 total
|
|
Tests: 4 failed, 4 total
|
|
Snapshots: 0 total
|
|
Time: <<REPLACED>>
|
|
Ran all test suites matching unhandledRejectionTest.test.js.",
|
|
}
|
|
`;
|
|
|
|
exports[`succeeds for async handled promise rejections 1`] = `
|
|
Object {
|
|
"rest": "PASS __tests__/rejectionHandled.test.js
|
|
✓ async function succeeds because the promise is eventually awaited by assertion
|
|
✓ async function succeeds because the promise is eventually directly awaited
|
|
✓ sync function succeeds because the promise is eventually handled by \`.catch\` handler",
|
|
"summary": "Test Suites: 1 passed, 1 total
|
|
Tests: 3 passed, 3 total
|
|
Snapshots: 0 total
|
|
Time: <<REPLACED>>
|
|
Ran all test suites matching rejectionHandled.test.js.",
|
|
}
|
|
`;
|