forked from jestjs/jest
/
testTodo.test.ts
47 lines (41 loc) 路 1.61 KB
/
testTodo.test.ts
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
/**
* 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.
*/
import path from 'path';
import {wrap} from 'jest-snapshot-serializer-raw';
import runJest from '../runJest';
import {extractSummary} from '../Utils';
const dir = path.resolve(__dirname, '../test-todo');
test('works with all statuses', () => {
const result = runJest(dir, ['statuses.test.js']);
expect(result.status).toBe(1);
const {rest} = extractSummary(result.stderr);
expect(wrap(rest)).toMatchSnapshot();
});
test('shows error messages when called with no arguments', () => {
const result = runJest(dir, ['todoNoArgs.test.js']);
expect(result.status).toBe(1);
const {rest} = extractSummary(result.stderr);
expect(wrap(rest)).toMatchSnapshot();
});
test('shows error messages when called with multiple arguments', () => {
const result = runJest(dir, ['todoMultipleArgs.test.js']);
expect(result.status).toBe(1);
const {rest} = extractSummary(result.stderr);
expect(wrap(rest)).toMatchSnapshot();
});
test('shows error messages when called with invalid argument', () => {
const result = runJest(dir, ['todoNonString.test.js']);
expect(result.status).toBe(1);
const {rest} = extractSummary(result.stderr);
expect(wrap(rest)).toMatchSnapshot();
});
test('shows todo messages when in verbose mode', () => {
const result = runJest(dir, ['verbose.test.js', '--verbose']);
expect(result.status).toBe(0);
const {rest} = extractSummary(result.stderr);
expect(wrap(rest)).toMatchSnapshot();
});