-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Expand file tree
/
Copy pathget_no_test_found.js
More file actions
36 lines (32 loc) · 871 Bytes
/
get_no_test_found.js
File metadata and controls
36 lines (32 loc) · 871 Bytes
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
import chalk from 'chalk';
import pluralize from './pluralize';
const getNoTestFound = (testRunData, globalConfig): string => {
const testFiles = testRunData.reduce(
(current, testRun) => (current += testRun.matches.total),
0,
);
let dataMessage;
if (globalConfig.runTestsByPath) {
dataMessage = `Files: ${globalConfig.nonFlagArgs
.map(p => `"${p}"`)
.join(', ')}`;
} else {
dataMessage = `Pattern: ${chalk.yellow(
globalConfig.testPathPattern,
)} - 0 matches`;
}
return (
chalk.bold('No tests found') +
'\n' +
`In ${chalk.bold(process.cwd())}` +
'\n' +
` ${pluralize('file', testFiles, 's')} checked across ${pluralize(
'project',
testRunData.length,
's',
)}. for more details run with \`--verbose\`` +
'\n' +
dataMessage
);
};
module.exports = getNoTestFound;