-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Expand file tree
/
Copy pathpass_with_no_tests.test.js
More file actions
39 lines (32 loc) · 1.05 KB
/
pass_with_no_tests.test.js
File metadata and controls
39 lines (32 loc) · 1.05 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
/**
* 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 runJest = require('../runJest');
const DIR = path.resolve(__dirname, '../pass_with_no_tests-test');
describe('jest --passWithNoTests', () => {
test('fails the test suite if no files are found', () => {
const result = runJest(DIR, ['--testPathPattern', '/non/existing/path/']);
const status = result.status;
const stdout = result.stdout.toString();
expect(stdout).toMatch('No tests found');
expect(status).toBe(1);
});
test("doesn't fail the test suite if no files are found", () => {
const result = runJest(DIR, [
'--testPathPattern',
'/non/existing/path/',
'--passWithNoTests',
]);
const status = result.status;
const stdout = result.stdout.toString();
expect(stdout).toMatch('No tests found');
expect(status).toBe(0);
});
});