supertape 7.2.3 → 7.3.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,12 @@
1
+ 2022.05.30, v7.3.0
2
+
3
+ feature:
4
+ - (package) eslint-plugin-putout v15.4.0
5
+ - (package) lerna v5.0.0
6
+ - (supertape) exit codes: add SKIPED
7
+ - (package) putout v26.0.0
8
+
9
+
1
10
  2022.04.06, v7.2.3
2
11
 
3
12
  fix:
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_SKIPED` - 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 | `SKIPED` | works only with `SUPERTAPE_CHECK_SKIPED` env variable when skiped files 1 and more |
271
+
272
+ Here is how exit code can look like:
273
+
274
+ ```js
275
+ import {SKIPED} from 'supertape/exit-codes';
276
+
277
+ const env = {
278
+ ESCOVER_SUCCESS_EXIT_CODE: SKIPED,
279
+ SUPERTAPE_CHECK_SKIPED: 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
+ SKIPED,
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_SKIPED = '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_SKIPED) && skiped)
63
+ return exit(SKIPED);
64
+
65
+ if (failed)
60
66
  return exit(FAIL);
61
- }
62
67
 
63
68
  if (code === INVALID_OPTION) {
64
69
  stderr.write(`${message}\n`);
@@ -180,11 +185,9 @@ async function cli({argv, cwd, stdout, isStop}) {
180
185
  return OK;
181
186
 
182
187
  await Promise.all(promises);
183
- const [{failed}] = await once(supertape.run(), 'end');
188
+ const [result] = await once(supertape.run(), 'end');
184
189
 
185
- return {
186
- failed,
187
- };
190
+ return result;
188
191
  }
189
192
 
190
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 SKIPED = 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
+ SKIPED,
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.3",
3
+ "version": "7.3.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": {
@@ -78,14 +79,14 @@
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"