supertape 11.0.3 → 11.1.0
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/README.md +4 -4
- package/bin/subscribe.mjs +2 -2
- package/lib/cli.js +24 -12
- package/lib/exit-codes.js +2 -2
- package/lib/run-tests.js +2 -2
- package/package.json +2 -2
package/ChangeLog
CHANGED
package/README.md
CHANGED
|
@@ -282,16 +282,16 @@ test('lib: diff', (t) => {
|
|
|
282
282
|
| 2 | `WAS_STOP` | test was halted by user |
|
|
283
283
|
| 3 | `UNHANDLED`| unhandled exception occurred |
|
|
284
284
|
| 4 | `INVALID_OPTION`| wrong option provided |
|
|
285
|
-
| 5 | `
|
|
285
|
+
| 5 | `SKIPPED` | works only with `SUPERTAPE_CHECK_SKIPPED` env variable when skipped files 1 and more |
|
|
286
286
|
|
|
287
287
|
Here is how exit code can look like:
|
|
288
288
|
|
|
289
289
|
```js
|
|
290
|
-
import {
|
|
290
|
+
import {SKIPPED} from 'supertape/exit-codes';
|
|
291
291
|
|
|
292
292
|
const env = {
|
|
293
|
-
ESCOVER_SUCCESS_EXIT_CODE:
|
|
294
|
-
|
|
293
|
+
ESCOVER_SUCCESS_EXIT_CODE: SKIPPED,
|
|
294
|
+
SUPERTAPE_CHECK_SKIPPED: 1,
|
|
295
295
|
};
|
|
296
296
|
|
|
297
297
|
export default {
|
package/bin/subscribe.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {keypress} from '@putout/cli-keypress';
|
|
2
2
|
import {parse} from 'flatted';
|
|
3
3
|
import harnessCreator from '../lib/formatter/harness.js';
|
|
4
4
|
import {
|
|
@@ -14,7 +14,7 @@ const {createHarness} = harnessCreator;
|
|
|
14
14
|
const resolveFormatter = async (name) => await import(`@supertape/formatter-${name}`);
|
|
15
15
|
|
|
16
16
|
export async function subscribe({name, exit, worker, stdout}) {
|
|
17
|
-
const {isStop} =
|
|
17
|
+
const {isStop} = keypress();
|
|
18
18
|
const harness = createHarness(await resolveFormatter(name));
|
|
19
19
|
|
|
20
20
|
harness.pipe(stdout);
|
package/lib/cli.js
CHANGED
|
@@ -8,18 +8,18 @@ const {pathToFileURL} = require('node:url');
|
|
|
8
8
|
const glob = require('glob');
|
|
9
9
|
const fullstore = require('fullstore');
|
|
10
10
|
const tryToCatch = require('try-to-catch');
|
|
11
|
-
const keypress = require('@putout/cli-keypress');
|
|
11
|
+
const {keypress: _keypress} = require('@putout/cli-keypress');
|
|
12
12
|
|
|
13
13
|
const {parseArgs, yargsOptions} = require('./cli/parse-args');
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const _supertape = require('..');
|
|
16
16
|
const {
|
|
17
17
|
OK,
|
|
18
18
|
FAIL,
|
|
19
19
|
WAS_STOP,
|
|
20
20
|
UNHANDLED,
|
|
21
21
|
INVALID_OPTION,
|
|
22
|
-
|
|
22
|
+
SKIPPED,
|
|
23
23
|
} = require('./exit-codes');
|
|
24
24
|
|
|
25
25
|
const isExclude = (a) => !a.includes('node_modules');
|
|
@@ -28,13 +28,25 @@ const removeDuplicates = (a) => Array.from(new Set(a));
|
|
|
28
28
|
const filesCount = fullstore(0);
|
|
29
29
|
|
|
30
30
|
const {
|
|
31
|
-
|
|
31
|
+
SUPERTAPE_CHECK_SKIPPED = '0',
|
|
32
32
|
} = process.env;
|
|
33
33
|
|
|
34
|
-
module.exports = async (
|
|
35
|
-
|
|
34
|
+
module.exports = async (overrides = {}) => {
|
|
35
|
+
const {
|
|
36
|
+
argv,
|
|
37
|
+
cwd,
|
|
38
|
+
stdout,
|
|
39
|
+
stderr,
|
|
40
|
+
exit,
|
|
41
|
+
workerFormatter,
|
|
42
|
+
keypress = _keypress,
|
|
43
|
+
supertape = _supertape,
|
|
44
|
+
} = overrides;
|
|
45
|
+
|
|
46
|
+
const isStop = overrides.isStop || keypress().isStop;
|
|
36
47
|
|
|
37
48
|
const [error, result] = await tryToCatch(cli, {
|
|
49
|
+
supertape,
|
|
38
50
|
argv,
|
|
39
51
|
cwd,
|
|
40
52
|
stdout,
|
|
@@ -55,8 +67,11 @@ module.exports = async ({argv, cwd, stdout, stderr, exit, isStop, workerFormatte
|
|
|
55
67
|
skipped,
|
|
56
68
|
} = result;
|
|
57
69
|
|
|
58
|
-
if (
|
|
59
|
-
return exit(
|
|
70
|
+
if (isStop())
|
|
71
|
+
return exit(WAS_STOP);
|
|
72
|
+
|
|
73
|
+
if (Number(SUPERTAPE_CHECK_SKIPPED) && skipped)
|
|
74
|
+
return exit(SKIPPED);
|
|
60
75
|
|
|
61
76
|
if (failed)
|
|
62
77
|
return exit(FAIL);
|
|
@@ -66,13 +81,10 @@ module.exports = async ({argv, cwd, stdout, stderr, exit, isStop, workerFormatte
|
|
|
66
81
|
return exit(code);
|
|
67
82
|
}
|
|
68
83
|
|
|
69
|
-
if (isStop())
|
|
70
|
-
return exit(WAS_STOP);
|
|
71
|
-
|
|
72
84
|
return exit(OK);
|
|
73
85
|
};
|
|
74
86
|
|
|
75
|
-
async function cli({argv, cwd, stdout, isStop, workerFormatter}) {
|
|
87
|
+
async function cli({argv, cwd, stdout, isStop, workerFormatter, supertape}) {
|
|
76
88
|
const args = parseArgs(argv);
|
|
77
89
|
|
|
78
90
|
if (args.version) {
|
package/lib/exit-codes.js
CHANGED
|
@@ -5,7 +5,7 @@ const FAIL = 1;
|
|
|
5
5
|
const WAS_STOP = 2;
|
|
6
6
|
const UNHANDLED = 3;
|
|
7
7
|
const INVALID_OPTION = 4;
|
|
8
|
-
const
|
|
8
|
+
const SKIPPED = 5;
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
11
|
OK,
|
|
@@ -13,5 +13,5 @@ module.exports = {
|
|
|
13
13
|
WAS_STOP,
|
|
14
14
|
UNHANDLED,
|
|
15
15
|
INVALID_OPTION,
|
|
16
|
-
|
|
16
|
+
SKIPPED,
|
|
17
17
|
};
|
package/lib/run-tests.js
CHANGED
|
@@ -41,10 +41,10 @@ module.exports = async (tests, {formatter, operators, isStop}) => {
|
|
|
41
41
|
isStop,
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
const
|
|
44
|
+
const notSkippedTests = tests.filter(notSkip);
|
|
45
45
|
const skipped = tests.filter(isSkip).length;
|
|
46
46
|
|
|
47
|
-
return await runTests(
|
|
47
|
+
return await runTests(notSkippedTests, {
|
|
48
48
|
formatter,
|
|
49
49
|
operators,
|
|
50
50
|
skipped,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "supertape",
|
|
3
|
-
"version": "11.0
|
|
3
|
+
"version": "11.1.0",
|
|
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",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@cloudcmd/stub": "^4.0.0",
|
|
43
|
-
"@putout/cli-keypress": "^
|
|
43
|
+
"@putout/cli-keypress": "^3.0.0",
|
|
44
44
|
"@putout/cli-validate-args": "^2.0.0",
|
|
45
45
|
"@supertape/engine-loader": "^2.0.0",
|
|
46
46
|
"@supertape/formatter-fail": "^4.0.0",
|