supertape 12.0.1 → 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 +10 -0
- package/lib/cli/parse-args.js +53 -46
- package/lib/cli.js +25 -9
- 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
|
@@ -5,12 +5,16 @@ const {resolve: resolvePath} = require('node:path');
|
|
|
5
5
|
const {once} = require('node:events');
|
|
6
6
|
const {pathToFileURL} = require('node:url');
|
|
7
7
|
|
|
8
|
-
const glob = require('glob');
|
|
9
8
|
const fullstore = require('fullstore');
|
|
10
9
|
const {tryToCatch} = require('try-to-catch');
|
|
11
10
|
const {keypress: _keypress} = require('@putout/cli-keypress');
|
|
12
11
|
|
|
13
|
-
const {
|
|
12
|
+
const {sync: _globSync} = require('glob');
|
|
13
|
+
|
|
14
|
+
const {
|
|
15
|
+
parseArgs,
|
|
16
|
+
getYargsOptions,
|
|
17
|
+
} = require('./cli/parse-args');
|
|
14
18
|
|
|
15
19
|
const _supertape = require('..');
|
|
16
20
|
const {
|
|
@@ -41,11 +45,12 @@ module.exports = async (overrides = {}) => {
|
|
|
41
45
|
workerFormatter,
|
|
42
46
|
keypress = _keypress,
|
|
43
47
|
supertape = _supertape,
|
|
48
|
+
globSync = _globSync,
|
|
44
49
|
} = overrides;
|
|
45
50
|
|
|
46
51
|
const isStop = overrides.isStop || keypress().isStop;
|
|
47
52
|
|
|
48
|
-
const [error, result] = await tryToCatch(
|
|
53
|
+
const [error, result] = await tryToCatch(_cli, {
|
|
49
54
|
supertape,
|
|
50
55
|
argv,
|
|
51
56
|
cwd,
|
|
@@ -53,6 +58,7 @@ module.exports = async (overrides = {}) => {
|
|
|
53
58
|
exit,
|
|
54
59
|
isStop,
|
|
55
60
|
workerFormatter,
|
|
61
|
+
globSync,
|
|
56
62
|
});
|
|
57
63
|
|
|
58
64
|
if (error) {
|
|
@@ -84,7 +90,17 @@ module.exports = async (overrides = {}) => {
|
|
|
84
90
|
return exit(OK);
|
|
85
91
|
};
|
|
86
92
|
|
|
87
|
-
async function
|
|
93
|
+
async function _cli(overrides) {
|
|
94
|
+
const {
|
|
95
|
+
argv,
|
|
96
|
+
cwd,
|
|
97
|
+
stdout,
|
|
98
|
+
isStop,
|
|
99
|
+
workerFormatter,
|
|
100
|
+
supertape,
|
|
101
|
+
globSync,
|
|
102
|
+
} = overrides;
|
|
103
|
+
|
|
88
104
|
const args = parseArgs(argv);
|
|
89
105
|
|
|
90
106
|
if (args.version) {
|
|
@@ -101,9 +117,11 @@ async function cli({argv, cwd, stdout, isStop, workerFormatter, supertape}) {
|
|
|
101
117
|
|
|
102
118
|
const {validateArgs} = await import('@putout/cli-validate-args');
|
|
103
119
|
|
|
120
|
+
const {boolean, string} = getYargsOptions();
|
|
121
|
+
|
|
104
122
|
const error = await validateArgs(args, [
|
|
105
|
-
...
|
|
106
|
-
...
|
|
123
|
+
...boolean,
|
|
124
|
+
...string,
|
|
107
125
|
]);
|
|
108
126
|
|
|
109
127
|
if (error)
|
|
@@ -118,9 +136,7 @@ async function cli({argv, cwd, stdout, isStop, workerFormatter, supertape}) {
|
|
|
118
136
|
const allFiles = [];
|
|
119
137
|
|
|
120
138
|
for (const arg of args._) {
|
|
121
|
-
const files =
|
|
122
|
-
.sync(arg)
|
|
123
|
-
.filter(isExclude);
|
|
139
|
+
const files = globSync(arg).filter(isExclude);
|
|
124
140
|
|
|
125
141
|
allFiles.push(...files);
|
|
126
142
|
}
|
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",
|