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 CHANGED
@@ -1,3 +1,13 @@
1
+ 2026.01.07, v12.0.3
2
+
3
+ feature:
4
+ - cd916cb cli: get rid of mock-require
5
+
6
+ 2026.01.07, v12.0.2
7
+
8
+ feature:
9
+ - 0803938 supertape: get rid of mock-require
10
+
1
11
  2026.01.07, v12.0.1
2
12
 
3
13
  fix:
@@ -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
@@ -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 {parseArgs, yargsOptions} = require('./cli/parse-args');
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(cli, {
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 cli({argv, cwd, stdout, isStop, workerFormatter, supertape}) {
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
- ...yargsOptions.boolean,
106
- ...yargsOptions.string,
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 = glob
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.1",
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",