supertape 7.2.2 → 7.4.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 CHANGED
@@ -1,3 +1,35 @@
1
+ 2022.06.09, v7.4.0
2
+
3
+ fix:
4
+ - (supertape) SKIPED -> SKIPPED
5
+
6
+
7
+ feature:
8
+ - (package) jest-diff v28.1.1
9
+ - (package) @iocmd/wait v2.1.0
10
+
11
+
12
+ 2022.05.30, v7.3.0
13
+
14
+ feature:
15
+ - (package) eslint-plugin-putout v15.4.0
16
+ - (package) lerna v5.0.0
17
+ - (supertape) exit codes: add SKIPED
18
+ - (package) putout v26.0.0
19
+
20
+
21
+ 2022.04.06, v7.2.3
22
+
23
+ fix:
24
+ - (@supertape/engine-loader) rm unused @cloudcmd/stub
25
+
26
+
27
+ feature:
28
+ - (package) @supertape/operator-stub v2.0.0
29
+ - (package) @cloudcmd/stub v4.0.0
30
+ - (@supertape/operator-stub) drop support of node < 16
31
+
32
+
1
33
  2022.04.06, v7.2.2
2
34
 
3
35
  feature:
package/README.md CHANGED
@@ -59,6 +59,7 @@ Options
59
59
  - `SUPERTAPE_CHECK_DUPLICATES` - toggle check duplicates;
60
60
  - `SUPERTAPE_CHECK_SCOPES` - check that test message has a scope: `scope: subject`;
61
61
  - `SUPERTAPE_CHECK_ASSERTIONS_COUNT` - check that assertion count is no more then 1;
62
+ - `SUPERTAPE_CHECK_SKIPPED` - check that skiped count equal to `0`, exit with status code
62
63
 
63
64
  ```js
64
65
  test('tape: error', (t) => {
@@ -255,6 +256,34 @@ test('lib: diff', (t) => {
255
256
  `;
256
257
  ```
257
258
 
259
+ ## 🚪Exit Codes
260
+
261
+ 📼**Supertape** can have one of next [exit codes](https://github.com/coderaiser/supertape/blob/master/packages/supertape/lib/exit-codes.js):
262
+
263
+ | Code | Name | Description |
264
+ |------|------|-----------------|
265
+ | 0 | `OK` | no errors found |
266
+ | 1 | `FAIL` | test failed |
267
+ | 2 | `WAS_STOP` | test was halted by user |
268
+ | 3 | `UNHANDLED`| unhandled exception occured |
269
+ | 4 | `INVALID_OPTION`| wrong option provided |
270
+ | 5 | `SKIPPED` | works only with `SUPERTAPE_CHECK_SKIPPED` env variable when skipped files 1 and more |
271
+
272
+ Here is how exit code can look like:
273
+
274
+ ```js
275
+ import {SKIPPED} from 'supertape/exit-codes';
276
+
277
+ const env = {
278
+ ESCOVER_SUCCESS_EXIT_CODE: SKIPPED,
279
+ SUPERTAPE_CHECK_SKIPPED: 1,
280
+ };
281
+
282
+ export default {
283
+ test: () => [env, `escover tape 'test/**/*.js' 'lib/**/*.spec.js'`],
284
+ };
285
+ ```
286
+
258
287
  ## License
259
288
 
260
289
  MIT
package/lib/cli.js CHANGED
@@ -18,6 +18,7 @@ const {
18
18
  WAS_STOP,
19
19
  UNHANDLED,
20
20
  INVALID_OPTION,
21
+ SKIPPED,
21
22
  } = require('./exit-codes');
22
23
 
23
24
  const {isArray} = Array;
@@ -33,6 +34,7 @@ const {
33
34
  SUPERTAPE_CHECK_DUPLICATES = '1',
34
35
  SUPERTAPE_CHECK_SCOPES = '1',
35
36
  SUPERTAPE_CHECK_ASSERTIONS_COUNT = '1',
37
+ SUPERTAPE_CHECK_SKIPPED = '0',
36
38
  } = process.env;
37
39
 
38
40
  module.exports = async ({argv, cwd, stdout, stderr, exit}) => {
@@ -54,11 +56,14 @@ module.exports = async ({argv, cwd, stdout, stderr, exit}) => {
54
56
  failed,
55
57
  code,
56
58
  message,
59
+ skiped,
57
60
  } = result;
58
61
 
59
- if (failed) {
62
+ if (Number(SUPERTAPE_CHECK_SKIPPED) && skiped)
63
+ return exit(SKIPPED);
64
+
65
+ if (failed)
60
66
  return exit(FAIL);
61
- }
62
67
 
63
68
  if (code === INVALID_OPTION) {
64
69
  stderr.write(`${message}\n`);
@@ -140,6 +145,7 @@ async function cli({argv, cwd, stdout, isStop}) {
140
145
  await import(module);
141
146
 
142
147
  const allFiles = [];
148
+
143
149
  for (const arg of args._) {
144
150
  const files = glob.sync(arg).filter(isExclude);
145
151
  allFiles.push(...files);
@@ -179,11 +185,9 @@ async function cli({argv, cwd, stdout, isStop}) {
179
185
  return OK;
180
186
 
181
187
  await Promise.all(promises);
182
- const [{failed}] = await once(supertape.run(), 'end');
188
+ const [result] = await once(supertape.run(), 'end');
183
189
 
184
- return {
185
- failed,
186
- };
190
+ return result;
187
191
  }
188
192
 
189
193
  module.exports._filesCount = filesCount;
package/lib/exit-codes.js CHANGED
@@ -5,6 +5,7 @@ const FAIL = 1;
5
5
  const WAS_STOP = 2;
6
6
  const UNHANDLED = 3;
7
7
  const INVALID_OPTION = 4;
8
+ const SKIPPED = 5;
8
9
 
9
10
  module.exports = {
10
11
  OK,
@@ -12,5 +13,6 @@ module.exports = {
12
13
  WAS_STOP,
13
14
  UNHANDLED,
14
15
  INVALID_OPTION,
16
+ SKIPPED,
15
17
  };
16
18
 
package/lib/is-debug.js CHANGED
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  const argv = process.execArgv.join();
4
- const isDebug = argv.includes('inspect') || argv.includes('debug');
5
4
 
6
- module.exports = isDebug;
5
+ module.exports = argv.includes('inspect') || argv.includes('debug');
7
6
 
package/lib/supertape.js CHANGED
@@ -68,13 +68,13 @@ function _createEmitter({quiet, format, getOperators, isStop}) {
68
68
  harness.pipe(stdout);
69
69
 
70
70
  const operators = await getOperators();
71
- const {failed} = await runTests(tests, {
71
+ const result = await runTests(tests, {
72
72
  formatter,
73
73
  operators,
74
74
  isStop,
75
75
  });
76
76
 
77
- emitter.emit('end', {failed});
77
+ emitter.emit('end', result);
78
78
  });
79
79
 
80
80
  return emitter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supertape",
3
- "version": "7.2.2",
3
+ "version": "7.4.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",
@@ -14,7 +14,8 @@
14
14
  "default": "./lib/supertape.js"
15
15
  },
16
16
  "./bin/supertape": "./bin/supertape.mjs",
17
- "./cli": "./lib/cli.js"
17
+ "./cli": "./lib/cli.js",
18
+ "./exit-codes": "./lib/exit-codes.js"
18
19
  },
19
20
  "type": "commonjs",
20
21
  "bin": {
@@ -47,12 +48,12 @@
47
48
  "@supertape/formatter-progress-bar": "^2.0.0",
48
49
  "@supertape/formatter-short": "^1.0.0",
49
50
  "@supertape/formatter-tap": "^2.0.0",
50
- "@supertape/operator-stub": "^1.0.0",
51
+ "@supertape/operator-stub": "^2.0.0",
51
52
  "cli-progress": "^3.8.2",
52
53
  "deep-equal": "^2.0.3",
53
54
  "fullstore": "^3.0.0",
54
55
  "glob": "^7.1.6",
55
- "jest-diff": "^27.0.1",
56
+ "jest-diff": "^28.1.1",
56
57
  "once": "^1.4.0",
57
58
  "resolve": "^1.17.0",
58
59
  "stacktracey": "^2.1.7",
@@ -73,19 +74,19 @@
73
74
  ],
74
75
  "devDependencies": {
75
76
  "@babel/core": "^7.12.9",
76
- "@iocmd/wait": "^1.0.0",
77
+ "@iocmd/wait": "^2.1.0",
77
78
  "c8": "^7.3.5",
78
79
  "check-dts": "^0.6.5",
79
80
  "eslint": "^8.0.0",
80
81
  "eslint-plugin-node": "^11.1.0",
81
- "eslint-plugin-putout": "^14.0.0",
82
+ "eslint-plugin-putout": "^15.4.0",
82
83
  "find-up": "^6.3.0",
83
84
  "madrun": "^9.0.0",
84
85
  "mock-require": "^3.0.2",
85
86
  "montag": "^1.0.0",
86
87
  "nodemon": "^2.0.2",
87
88
  "pullout": "^4.0.0",
88
- "putout": "^25.0.0",
89
+ "putout": "^26.0.0",
89
90
  "runsome": "^1.0.0",
90
91
  "try-catch": "^3.0.0",
91
92
  "typescript": "^4.4.4"