forked from mrsone40/vets-website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-unit-test-help.js
More file actions
78 lines (76 loc) · 2.41 KB
/
run-unit-test-help.js
File metadata and controls
78 lines (76 loc) · 2.41 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* eslint-disable no-console */
const commandLineUsage = require('command-line-usage');
const helpSections = [
{
header: 'Unit test run script',
},
{
header: 'Examples',
content: [
{
desc: '1. Run all the unit tests ',
example: '$ yarn test:unit',
},
{
desc: '2. Run tests for a specific app folder ',
example: '$ yarn test:unit --app-folder vaos',
},
{
desc: '3. Run tests with extra error logging for a specific file',
example:
'$ yarn test:unit --log-level debug src/applications/vaos/tests/components/ExpressCareListItem.jsx',
},
{
desc: '4. Run tests with code coverage metrics as HTML',
example:
'$ yarn test:unit --app-folder personalization --coverage --coverage-html',
},
],
},
{
header: 'Options',
optionList: [
{
name: 'log-level',
typeLabel: '{underline log}, {underline debug}, {underline trace}',
description:
'Set the log level for the unit test output. {underline debug} provides errors with stack traces scrubbed of node_modules lines.' +
' {underline trace} outputs all errors and warnings. Defaults to {underline log}, which hides errors outside of specific test failures',
},
{
name: 'coverage',
typeLabel: '{underline boolean}',
description:
'Runs the unit tests with code coverage metrics, and outputs the results to an json report in coverage/',
},
{
name: 'coverage-html',
typeLabel: '{underline boolean}',
description:
'Used in conjunction with `--coverage` Runs the unit tests with code coverage metrics, and outputs the results to an html report in coverage/ instead of json.',
},
{
name: 'app-folder',
typeLabel: '{underline folder name}',
description:
'Run all tests in the specified folder in src/applications',
defaultOption: true,
},
{
name: 'path',
typeLabel: '{underline glob}',
description:
'A file or glob to indicate which tests to run. This is the default option.',
defaultOption: true,
},
{
name: 'help',
typeLabel: '{underline boolean}',
description: 'Show the usage guide',
},
],
},
];
module.exports = () => {
console.log(commandLineUsage(helpSections));
};