supertape 6.10.0 → 6.13.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,46 @@
1
+ 2022.01.15, v6.13.0
2
+
3
+ feature:
4
+ - (supertape) add exit code 5 for skip
5
+ - (@supertape/operator-stub) notCalled: no arg
6
+
7
+
8
+ 2022.01.14, v6.12.1
9
+
10
+ fix:
11
+ - (@supertape) engine-loader: windows support
12
+ - (supertape) windows support
13
+
14
+ 2022.01.14, v6.12.0
15
+
16
+ feature:
17
+ - (supertape) get rid of simport
18
+ - (package) putout v24.1.0
19
+ - (package) eslint-plugin-putout v13.0.1
20
+ - (@supertape/engine-loader) get rid of simport
21
+ - (@supertape/formatter-progress-bar) add newline befor fail count
22
+
23
+
24
+ 2022.01.04, v6.11.0
25
+
26
+ fix:
27
+ - (supertape) types: any -> unknown
28
+ - (@supertape/operator-stub) types: any -> unknown
29
+
30
+ feature:
31
+ - (package) yargs-parser v21.0.0
32
+ - (supertape) notOk: add ability to stringify content of passed value
33
+ - (package) putout v23.0.0
34
+ - (package) check-dts v0.6.5
35
+ - (package) check-dts v0.6.5
36
+ - (package) check-dts v0.6.5
37
+ - (@supertape/formatter-progress-bar) add color constant
38
+ - (package) eslint-plugin-putout v12.0.0
39
+ - (package) putout v22.0.0
40
+ - (package) check-dts v0.6.3
41
+ - (supertape) putout v21
42
+
43
+
1
44
  2021.10.23, v6.10.0
2
45
 
3
46
  feature:
package/README.md CHANGED
@@ -1,11 +1,9 @@
1
- # Supertape [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]
1
+ # 📼 `Supertape` [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]
2
2
 
3
3
  [NPMURL]: https://npmjs.org/package/supertape "npm"
4
4
  [NPMIMGURL]: https://img.shields.io/npm/v/supertape.svg?style=flat&longCache=true
5
5
  [BuildStatusURL]: https://github.com/coderaiser/supertape/actions?query=workflow%3A%22Node+CI%22 "Build Status"
6
6
  [BuildStatusIMGURL]: https://github.com/coderaiser/supertape/workflows/Node%20CI/badge.svg
7
- [DependencyStatusURL]: https://david-dm.org/coderaiser/supertape?path=packages/supertape "Dependency Status"
8
- [DependencyStatusIMGURL]: https://img.shields.io/david/coderaiser/supertape.svg?path=packages/supertape&style=flat&longCache=true
9
7
  [CoverageURL]: https://coveralls.io/github/coderaiser/supertape?branch=master
10
8
  [CoverageIMGURL]: https://coveralls.io/repos/coderaiser/supertape/badge.svg?branch=master&service=github
11
9
 
@@ -178,9 +176,8 @@ const test = require('supertape');
178
176
 
179
177
  test('lib: arguments', async (t) => {
180
178
  throw Error('hello');
181
- // will call t.fail with an error
182
- // will call t.end
183
-
179
+ // will call t.fail() with an error
180
+ // will call t.end()
184
181
  t.end();
185
182
  });
186
183
 
package/lib/cli.js CHANGED
@@ -2,15 +2,14 @@
2
2
 
3
3
  const {resolve: resolvePath} = require('path');
4
4
  const {once} = require('events');
5
+ const {pathToFileURL} = require('url');
5
6
 
6
7
  const yargsParser = require('yargs-parser');
7
8
  const glob = require('glob');
8
9
  const fullstore = require('fullstore');
9
10
  const tryToCatch = require('try-to-catch');
10
11
  const keypress = require('@putout/cli-keypress');
11
- const {createSimport} = require('simport');
12
-
13
- const simport = createSimport(__filename);
12
+ const {simpleImport} = require('./simple-import');
14
13
 
15
14
  const supertape = require('..');
16
15
  const {
@@ -19,9 +18,9 @@ const {
19
18
  WAS_STOP,
20
19
  UNHANDLED,
21
20
  INVALID_OPTION,
21
+ SKIP,
22
22
  } = require('./exit-codes');
23
23
 
24
- const {resolve} = require;
25
24
  const {isArray} = Array;
26
25
 
27
26
  const maybeFirst = (a) => isArray(a) ? a.pop() : a;
@@ -53,6 +52,7 @@ module.exports = async ({argv, cwd, stdout, stderr, exit}) => {
53
52
 
54
53
  const {
55
54
  failed,
55
+ skiped,
56
56
  code,
57
57
  message,
58
58
  } = result;
@@ -66,8 +66,13 @@ module.exports = async ({argv, cwd, stdout, stderr, exit}) => {
66
66
  return exit(code);
67
67
  }
68
68
 
69
- if (isStop())
69
+ if (isStop()) {
70
70
  return exit(WAS_STOP);
71
+ }
72
+
73
+ if (skiped) {
74
+ return exit(SKIP);
75
+ }
71
76
 
72
77
  return exit(OK);
73
78
  };
@@ -119,7 +124,7 @@ async function cli({argv, cwd, stdout, isStop}) {
119
124
  }
120
125
 
121
126
  if (args.help) {
122
- const help = await simport('./help.js');
127
+ const {help} = await import('./help.js');
123
128
  stdout.write(help());
124
129
  return OK;
125
130
  }
@@ -138,9 +143,7 @@ async function cli({argv, cwd, stdout, isStop}) {
138
143
  };
139
144
 
140
145
  for (const module of args.require)
141
- await simport(resolve(module, {
142
- paths: [cwd],
143
- }));
146
+ await import(module);
144
147
 
145
148
  const allFiles = [];
146
149
  for (const arg of args._) {
@@ -171,19 +174,24 @@ async function cli({argv, cwd, stdout, isStop}) {
171
174
  const files = removeDuplicates(allFiles);
172
175
 
173
176
  for (const file of files) {
174
- promises.push(simport(resolvePath(cwd, file)));
177
+ // always resolve before import for windows
178
+ const resolved = pathToFileURL(resolvePath(cwd, file));
179
+ promises.push(simpleImport(resolved));
175
180
  }
176
181
 
177
182
  filesCount(files.length);
178
183
 
179
184
  if (!promises.length)
180
- return OK;
185
+ return {
186
+ failed: false,
187
+ };
181
188
 
182
189
  await Promise.all(promises);
183
- const [{failed}] = await once(supertape.run(), 'end');
190
+ const [{failed, skiped}] = await once(supertape.run(), 'end');
184
191
 
185
192
  return {
186
193
  failed,
194
+ skiped,
187
195
  };
188
196
  }
189
197
 
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 SKIP = 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
+ SKIP,
15
17
  };
16
18
 
@@ -3,9 +3,7 @@
3
3
  const {EventEmitter} = require('events');
4
4
  const {createHarness} = require('./harness');
5
5
 
6
- const resolveFormatter = (name) => {
7
- return require(`@supertape/formatter-${name}`);
8
- };
6
+ const resolveFormatter = (name) => require(`@supertape/formatter-${name}`);
9
7
 
10
8
  module.exports.createFormatter = (name) => {
11
9
  const formatter = new EventEmitter();
package/lib/help.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- module.exports = () => {
3
+ module.exports.help = () => {
4
4
  const bin = require('../help.json');
5
5
  const usage = 'Usage: supertape [options] [path]';
6
6
  const result = [
package/lib/operators.mjs CHANGED
@@ -26,7 +26,7 @@ const ok = (actual, message = 'should be truthy') => ({
26
26
  const notOk = (actual, message = 'should be falsy') => ({
27
27
  is: !actual,
28
28
  expected: false,
29
- actual,
29
+ actual: actual && stringify(actual),
30
30
  message,
31
31
  });
32
32
 
@@ -40,6 +40,8 @@ const validateRegExp = (regexp) => {
40
40
  return null;
41
41
  };
42
42
 
43
+ const {stringify} = JSON;
44
+
43
45
  function match(actual, regexp, message = 'should match') {
44
46
  const error = validateRegExp(regexp);
45
47
 
package/lib/run-tests.js CHANGED
@@ -149,6 +149,7 @@ async function runOneTest({message, at, fn, extensions, formatter, count, total,
149
149
  if (!isReturn()) {
150
150
  const [timer, stopTimer] = timeout(SUPERTAPE_TIMEOUT, ['timeout']);
151
151
  const [error] = await Promise.race([tryToCatch(fn, t), timer]);
152
+
152
153
  stopTimer();
153
154
  isEnded(false);
154
155
 
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+
3
+ module.exports.simpleImport = (a) => import(a);
@@ -7,10 +7,10 @@ import {
7
7
 
8
8
  type Result = {
9
9
  is: boolean,
10
- expected: any,
11
- actual: any,
10
+ expected: unknown,
11
+ actual: unknown,
12
12
  message: string,
13
- }
13
+ };
14
14
 
15
15
  type Test = OperatorStub & {
16
16
  equal: (result: unknown, expected: unknown, message?: string) => Result;
@@ -25,13 +25,13 @@ type Test = OperatorStub & {
25
25
  match: (result: string, pattern: string | RegExp, message?: string) => Result;
26
26
  notMatch: (result: string, pattern: string | RegExp, message?: string) => Result;
27
27
  end: () => void;
28
- }
28
+ };
29
29
 
30
30
  type TestOptions = {
31
31
  checkAssertionsCount?: boolean,
32
32
  checkScopes?: boolean,
33
33
  checkDuplicates?: boolean,
34
- }
34
+ };
35
35
 
36
36
  declare function test(message: string, fn: (t: Test) => void, options?: TestOptions): void;
37
37
  declare namespace test {
package/lib/supertape.js CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  const {EventEmitter} = require('events');
4
4
  const once = require('once');
5
- const {createSimport} = require('simport');
6
5
 
7
6
  const options = require('../supertape.json');
8
7
 
@@ -11,7 +10,6 @@ const runTests = require('./run-tests');
11
10
  const createFormatter = once(require('./formatter').createFormatter);
12
11
 
13
12
  const createEmitter = once(_createEmitter);
14
- const simport = createSimport(__filename);
15
13
 
16
14
  const {assign} = Object;
17
15
  const {stdout} = process;
@@ -20,7 +18,7 @@ let mainEmitter;
20
18
 
21
19
  const getOperators = once(async () => {
22
20
  const {operators} = options;
23
- const {loadOperators} = await simport('@supertape/engine-loader');
21
+ const {loadOperators} = await import('@supertape/engine-loader');
24
22
 
25
23
  return await loadOperators(operators);
26
24
  });
@@ -70,13 +68,13 @@ function _createEmitter({quiet, format, getOperators, isStop}) {
70
68
  harness.pipe(stdout);
71
69
 
72
70
  const operators = await getOperators();
73
- const {failed} = await runTests(tests, {
71
+ const {failed, skiped} = await runTests(tests, {
74
72
  formatter,
75
73
  operators,
76
74
  isStop,
77
75
  });
78
76
 
79
- emitter.emit('end', {failed});
77
+ emitter.emit('end', {failed, skiped});
80
78
  });
81
79
 
82
80
  return emitter;
package/lib/validator.js CHANGED
@@ -67,9 +67,7 @@ module.exports.createValidator = ({tests}) => (msg, options) => {
67
67
  return [];
68
68
  };
69
69
 
70
- module.exports.getAt = () => {
71
- return getFileName();
72
- };
70
+ module.exports.getAt = () => getFileName();
73
71
 
74
72
  const CALLS_FROM_TEST = 3;
75
73
 
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "supertape",
3
- "version": "6.10.0",
3
+ "version": "6.13.0",
4
4
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
5
- "description": "tape compatible test runner with superpowers",
5
+ "description": "📼 Supertape fastest simplest test runner with lots of formatters",
6
6
  "homepage": "http://github.com/coderaiser/supertape",
7
7
  "main": "./lib/supertape.js",
8
8
  "exports": {
@@ -56,12 +56,11 @@
56
56
  "jest-diff": "^27.0.1",
57
57
  "once": "^1.4.0",
58
58
  "resolve": "^1.17.0",
59
- "simport": "^1.1.1",
60
59
  "stacktracey": "^2.1.7",
61
60
  "strip-ansi": "^7.0.0",
62
61
  "try-to-catch": "^3.0.0",
63
62
  "wraptile": "^3.0.0",
64
- "yargs-parser": "^20.2.4"
63
+ "yargs-parser": "^21.0.0"
65
64
  },
66
65
  "keywords": [
67
66
  "function",
@@ -77,18 +76,19 @@
77
76
  "@babel/core": "^7.12.9",
78
77
  "@iocmd/wait": "^1.0.0",
79
78
  "c8": "^7.3.5",
80
- "check-dts": "^0.5.5",
79
+ "check-dts": "^0.6.5",
81
80
  "eslint": "^8.0.0-beta.0",
82
81
  "eslint-plugin-node": "^11.1.0",
83
- "eslint-plugin-putout": "^10.0.1",
82
+ "eslint-plugin-putout": "^13.0.1",
84
83
  "madrun": "^8.0.0",
85
84
  "mock-require": "^3.0.2",
86
85
  "montag": "^1.0.0",
87
86
  "nodemon": "^2.0.2",
88
87
  "pullout": "^4.0.0",
89
- "putout": "^20.0.1",
88
+ "putout": "^24.1.0",
90
89
  "runsome": "^1.0.0",
91
- "try-catch": "^3.0.0"
90
+ "try-catch": "^3.0.0",
91
+ "typescript": "^4.4.4"
92
92
  },
93
93
  "license": "MIT",
94
94
  "engines": {