UNPKG

1.55 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, '__esModule', {
4 value: true
5});
6exports.default = getNoTestFound;
7
8function _chalk() {
9 const data = _interopRequireDefault(require('chalk'));
10
11 _chalk = function () {
12 return data;
13 };
14
15 return data;
16}
17
18var _pluralize = _interopRequireDefault(require('./pluralize'));
19
20function _interopRequireDefault(obj) {
21 return obj && obj.__esModule ? obj : {default: obj};
22}
23
24/**
25 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
26 *
27 * This source code is licensed under the MIT license found in the
28 * LICENSE file in the root directory of this source tree.
29 */
30function getNoTestFound(testRunData, globalConfig) {
31 const testFiles = testRunData.reduce(
32 (current, testRun) => current + (testRun.matches.total || 0),
33 0
34 );
35 let dataMessage;
36
37 if (globalConfig.runTestsByPath) {
38 dataMessage = `Files: ${globalConfig.nonFlagArgs
39 .map(p => `"${p}"`)
40 .join(', ')}`;
41 } else {
42 dataMessage = `Pattern: ${_chalk().default.yellow(
43 globalConfig.testPathPattern
44 )} - 0 matches`;
45 }
46
47 return (
48 _chalk().default.bold('No tests found, exiting with code 1') +
49 '\n' +
50 'Run with `--passWithNoTests` to exit with code 0' +
51 '\n' +
52 `In ${_chalk().default.bold(globalConfig.rootDir)}` +
53 '\n' +
54 ` ${(0, _pluralize.default)('file', testFiles, 's')} checked across ${(0,
55 _pluralize.default)(
56 'project',
57 testRunData.length,
58 's'
59 )}. Run with \`--verbose\` for more details.` +
60 '\n' +
61 dataMessage
62 );
63}