forked from jestjs/jest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testTodo.test.ts
53 lines (46 loc) · 1.81 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
48
49
50
51
52
53
/**
* 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 * as path from 'path';
import {extractSummary} from '../Utils';
import runJest from '../runJest';
const dir = path.resolve(__dirname, '../test-todo');
test('works with all statuses', () => {
const result = runJest(dir, ['statuses.test.js']);
expect(result.exitCode).toBe(1);
const {rest} = extractSummary(result.stderr);
expect(rest).toMatchSnapshot();
});
test('shows error messages when called with no arguments', () => {
const result = runJest(dir, ['todoNoArgs.test.js']);
expect(result.exitCode).toBe(1);
const {rest} = extractSummary(result.stderr);
expect(rest).toMatchSnapshot();
});
test('shows error messages when called with multiple arguments', () => {
const result = runJest(dir, ['todoMultipleArgs.test.js']);
expect(result.exitCode).toBe(1);
const {rest} = extractSummary(result.stderr);
expect(rest).toMatchSnapshot();
});
test('shows error messages when called with invalid argument', () => {
const result = runJest(dir, ['todoNonString.test.js']);
expect(result.exitCode).toBe(1);
const {rest} = extractSummary(result.stderr);
expect(rest).toMatchSnapshot();
});
test('shows todo messages when in verbose mode', () => {
const result = runJest(dir, ['verbose.test.js', '--verbose']);
expect(result.exitCode).toBe(0);
const {rest} = extractSummary(result.stderr);
expect(rest).toMatchSnapshot();
});
test('counts todo tests when inside of a `describe.only`', () => {
const result = runJest(dir, ['only-todo.test.js']);
expect(result.exitCode).toBe(0);
const {rest, summary} = extractSummary(result.stderr);
expect(`${rest}\n\n${summary}`).toMatchSnapshot();
});