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 CHANGED
@@ -1,3 +1,8 @@
1
+ 2026.01.07, v12.0.3
2
+
3
+ feature:
4
+ - cd916cb cli: get rid of mock-require
5
+
1
6
  2026.01.07, v12.0.2
2
7
 
3
8
  feature:
@@ -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
- SUPERTAPE_CHECK_DUPLICATES = '1',
11
- SUPERTAPE_CHECK_SCOPES = '1',
12
- SUPERTAPE_CHECK_ASSERTIONS_COUNT = '1',
13
- } = process.env;
14
-
15
- const yargsOptions = {
16
- configuration: {
17
- 'strip-aliased': true,
18
- 'strip-dashed': true,
19
- },
20
- coerce: {
21
- require: maybeArray,
22
- format: maybeFirst,
23
- },
24
- string: [
25
- 'format',
26
- 'require',
27
- ],
28
- boolean: [
29
- 'version',
30
- 'help',
31
- 'check-duplicates',
32
- 'check-scopes',
33
- 'check-assertions-count',
34
- 'worker',
35
- ],
36
- alias: {
37
- version: 'v',
38
- format: 'f',
39
- help: 'h',
40
- require: 'r',
41
- checkDuplicates: 'd',
42
- checkScopes: 's',
43
- checkAssertionsCount: 'a',
44
- },
45
- default: {
46
- format: 'progress-bar',
47
- require: [],
48
- checkDuplicates: SUPERTAPE_CHECK_DUPLICATES !== '0',
49
- checkScopes: SUPERTAPE_CHECK_SCOPES !== '0',
50
- checkAssertionsCount: SUPERTAPE_CHECK_ASSERTIONS_COUNT !== '0',
51
- worker: true,
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.yargsOptions = yargsOptions;
56
- module.exports.parseArgs = (argv) => yargsParser(argv, yargsOptions);
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 {parseArgs, yargsOptions} = require('./cli/parse-args');
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(cli, {
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 cli(overrides) {
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
- ...yargsOptions.boolean,
118
- ...yargsOptions.string,
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.2",
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",