supertape 12.0.2 → 12.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog +5 -0
- package/lib/cli/parse-args.js +53 -46
- package/lib/cli.js +11 -5
- package/package.json +1 -1
package/ChangeLog
CHANGED
package/lib/cli/parse-args.js
CHANGED
|
@@ -6,51 +6,58 @@ const {isArray} = Array;
|
|
|
6
6
|
const maybeFirst = (a) => isArray(a) ? a.pop() : a;
|
|
7
7
|
const maybeArray = (a) => isArray(a) ? a : [a];
|
|
8
8
|
|
|
9
|
-
const {
|
|
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
|
-
|
|
9
|
+
const getYargsOptions = () => {
|
|
10
|
+
const {
|
|
11
|
+
SUPERTAPE_CHECK_DUPLICATES = '1',
|
|
12
|
+
SUPERTAPE_CHECK_SCOPES = '1',
|
|
13
|
+
SUPERTAPE_CHECK_ASSERTIONS_COUNT = '1',
|
|
14
|
+
} = process.env;
|
|
15
|
+
|
|
16
|
+
const yargsOptions = {
|
|
17
|
+
configuration: {
|
|
18
|
+
'strip-aliased': true,
|
|
19
|
+
'strip-dashed': true,
|
|
20
|
+
},
|
|
21
|
+
coerce: {
|
|
22
|
+
require: maybeArray,
|
|
23
|
+
format: maybeFirst,
|
|
24
|
+
},
|
|
25
|
+
string: [
|
|
26
|
+
'format',
|
|
27
|
+
'require',
|
|
28
|
+
],
|
|
29
|
+
boolean: [
|
|
30
|
+
'version',
|
|
31
|
+
'help',
|
|
32
|
+
'check-duplicates',
|
|
33
|
+
'check-scopes',
|
|
34
|
+
'check-assertions-count',
|
|
35
|
+
'worker',
|
|
36
|
+
],
|
|
37
|
+
alias: {
|
|
38
|
+
version: 'v',
|
|
39
|
+
format: 'f',
|
|
40
|
+
help: 'h',
|
|
41
|
+
require: 'r',
|
|
42
|
+
checkDuplicates: 'd',
|
|
43
|
+
checkScopes: 's',
|
|
44
|
+
checkAssertionsCount: 'a',
|
|
45
|
+
},
|
|
46
|
+
default: {
|
|
47
|
+
format: 'progress-bar',
|
|
48
|
+
require: [],
|
|
49
|
+
checkDuplicates: SUPERTAPE_CHECK_DUPLICATES !== '0',
|
|
50
|
+
checkScopes: SUPERTAPE_CHECK_SCOPES !== '0',
|
|
51
|
+
checkAssertionsCount: SUPERTAPE_CHECK_ASSERTIONS_COUNT !== '0',
|
|
52
|
+
worker: true,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
return yargsOptions;
|
|
53
57
|
};
|
|
54
58
|
|
|
55
|
-
module.exports.
|
|
56
|
-
|
|
59
|
+
module.exports.getYargsOptions = getYargsOptions;
|
|
60
|
+
|
|
61
|
+
module.exports.parseArgs = (argv) => {
|
|
62
|
+
return yargsParser(argv, getYargsOptions());
|
|
63
|
+
};
|
package/lib/cli.js
CHANGED
|
@@ -11,7 +11,10 @@ const {keypress: _keypress} = require('@putout/cli-keypress');
|
|
|
11
11
|
|
|
12
12
|
const {sync: _globSync} = require('glob');
|
|
13
13
|
|
|
14
|
-
const {
|
|
14
|
+
const {
|
|
15
|
+
parseArgs,
|
|
16
|
+
getYargsOptions,
|
|
17
|
+
} = require('./cli/parse-args');
|
|
15
18
|
|
|
16
19
|
const _supertape = require('..');
|
|
17
20
|
const {
|
|
@@ -47,7 +50,7 @@ module.exports = async (overrides = {}) => {
|
|
|
47
50
|
|
|
48
51
|
const isStop = overrides.isStop || keypress().isStop;
|
|
49
52
|
|
|
50
|
-
const [error, result] = await tryToCatch(
|
|
53
|
+
const [error, result] = await tryToCatch(_cli, {
|
|
51
54
|
supertape,
|
|
52
55
|
argv,
|
|
53
56
|
cwd,
|
|
@@ -87,7 +90,7 @@ module.exports = async (overrides = {}) => {
|
|
|
87
90
|
return exit(OK);
|
|
88
91
|
};
|
|
89
92
|
|
|
90
|
-
async function
|
|
93
|
+
async function _cli(overrides) {
|
|
91
94
|
const {
|
|
92
95
|
argv,
|
|
93
96
|
cwd,
|
|
@@ -97,6 +100,7 @@ async function cli(overrides) {
|
|
|
97
100
|
supertape,
|
|
98
101
|
globSync,
|
|
99
102
|
} = overrides;
|
|
103
|
+
|
|
100
104
|
const args = parseArgs(argv);
|
|
101
105
|
|
|
102
106
|
if (args.version) {
|
|
@@ -113,9 +117,11 @@ async function cli(overrides) {
|
|
|
113
117
|
|
|
114
118
|
const {validateArgs} = await import('@putout/cli-validate-args');
|
|
115
119
|
|
|
120
|
+
const {boolean, string} = getYargsOptions();
|
|
121
|
+
|
|
116
122
|
const error = await validateArgs(args, [
|
|
117
|
-
...
|
|
118
|
-
...
|
|
123
|
+
...boolean,
|
|
124
|
+
...string,
|
|
119
125
|
]);
|
|
120
126
|
|
|
121
127
|
if (error)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "supertape",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.3",
|
|
4
4
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
5
5
|
"description": "📼 Supertape simplest high speed test runner with superpowers",
|
|
6
6
|
"homepage": "http://github.com/coderaiser/supertape",
|