forked from jestjs/jest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexpectAsyncMatcher.test.ts
More file actions
32 lines (26 loc) · 931 Bytes
/
expectAsyncMatcher.test.ts
File metadata and controls
32 lines (26 loc) · 931 Bytes
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
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import path from 'path';
import {wrap} from 'jest-snapshot-serializer-raw';
import runJest from '../runJest';
import {extractSummary} from '../Utils';
const dir = path.resolve(__dirname, '../expect-async-matcher');
test('works with passing tests', () => {
const result = runJest(dir, ['success.test.js']);
expect(result.status).toBe(0);
});
test('shows the correct errors in stderr when failing tests', () => {
const result = runJest(dir, ['failure.test.js']);
expect(result.status).toBe(1);
const rest = extractSummary(result.stderr)
.rest.split('\n')
.filter(line => line.indexOf('packages/expect/build/index.js') === -1)
.join('\n');
expect(wrap(rest)).toMatchSnapshot();
});