-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Expand file tree
/
Copy pathcli-accepts-exact-filenames.test.js
More file actions
51 lines (41 loc) · 1.14 KB
/
cli-accepts-exact-filenames.test.js
File metadata and controls
51 lines (41 loc) · 1.14 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
/**
* Copyright (c) 2014-present, Facebook, Inc. 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
*/
'use strict';
const path = require('path');
const skipOnWindows = require('../../scripts/skip_on_windows');
const {extractSummary, cleanup, writeFiles} = require('../utils');
const runJest = require('../runJest');
const DIR = path.resolve(__dirname, '../cli_accepts_exact_filenames');
skipOnWindows.suite();
beforeEach(() => cleanup(DIR));
afterAll(() => cleanup(DIR));
test('CLI accepts exact filenames', () => {
writeFiles(DIR, {
'bar.js': `
test('bar', () => console.log('Hey'));
`,
'foo/baz.js': `
test('baz', () => console.log('Hey'));
`,
'package.json': '{}',
});
const {stderr, stdout, status} = runJest(DIR, [
'-i',
'--ci=false',
'--forceExit',
'./bar.js',
'./foo/baz.js',
'./foo',
]);
expect(status).toBe(0);
const {rest, summary} = extractSummary(stderr);
expect(rest).toMatchSnapshot();
expect(summary).toMatchSnapshot();
expect(stdout).toMatchSnapshot();
});