supertape 6.9.4 → 6.12.1

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,45 @@
1
+ 2022.01.14, v6.12.1
2
+
3
+ fix:
4
+ - (@supertape) engine-loader: windows support
5
+ - (supertape) windows support
6
+
7
+ 2022.01.14, v6.12.0
8
+
9
+ feature:
10
+ - (supertape) get rid of simport
11
+ - (package) putout v24.1.0
12
+ - (package) eslint-plugin-putout v13.0.1
13
+ - (@supertape/engine-loader) get rid of simport
14
+ - (@supertape/formatter-progress-bar) add newline befor fail count
15
+
16
+
17
+ 2022.01.04, v6.11.0
18
+
19
+ fix:
20
+ - (supertape) types: any -> unknown
21
+ - (@supertape/operator-stub) types: any -> unknown
22
+
23
+ feature:
24
+ - (package) yargs-parser v21.0.0
25
+ - (supertape) notOk: add ability to stringify content of passed value
26
+ - (package) putout v23.0.0
27
+ - (package) check-dts v0.6.5
28
+ - (package) check-dts v0.6.5
29
+ - (package) check-dts v0.6.5
30
+ - (@supertape/formatter-progress-bar) add color constant
31
+ - (package) eslint-plugin-putout v12.0.0
32
+ - (package) putout v22.0.0
33
+ - (package) check-dts v0.6.3
34
+ - (supertape) putout v21
35
+
36
+
37
+ 2021.10.23, v6.10.0
38
+
39
+ feature:
40
+ - (supertape) checkAssertionsCount: add ability to check that assertions count not less then one
41
+
42
+
1
43
  2021.10.19, v6.9.4
2
44
 
3
45
  fix:
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 {
@@ -21,7 +20,6 @@ const {
21
20
  INVALID_OPTION,
22
21
  } = require('./exit-codes');
23
22
 
24
- const {resolve} = require;
25
23
  const {isArray} = Array;
26
24
 
27
25
  const maybeFirst = (a) => isArray(a) ? a.pop() : a;
@@ -119,7 +117,7 @@ async function cli({argv, cwd, stdout, isStop}) {
119
117
  }
120
118
 
121
119
  if (args.help) {
122
- const help = await simport('./help.js');
120
+ const {help} = await import('./help.js');
123
121
  stdout.write(help());
124
122
  return OK;
125
123
  }
@@ -138,9 +136,7 @@ async function cli({argv, cwd, stdout, isStop}) {
138
136
  };
139
137
 
140
138
  for (const module of args.require)
141
- await simport(resolve(module, {
142
- paths: [cwd],
143
- }));
139
+ await import(module);
144
140
 
145
141
  const allFiles = [];
146
142
  for (const arg of args._) {
@@ -171,7 +167,9 @@ async function cli({argv, cwd, stdout, isStop}) {
171
167
  const files = removeDuplicates(allFiles);
172
168
 
173
169
  for (const file of files) {
174
- promises.push(simport(resolvePath(cwd, file)));
170
+ // always resolve before import for windows
171
+ const resolved = pathToFileURL(resolvePath(cwd, file));
172
+ promises.push(simpleImport(resolved));
175
173
  }
176
174
 
177
175
  filesCount(files.length);
@@ -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
  });
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
 
@@ -96,6 +94,9 @@ function checkAssertionsCount(msg, filtered, options) {
96
94
  if (assertionsCount > 1)
97
95
  return [`Only one assertion per test allowed, looks like you have more`, at];
98
96
 
97
+ if (!assertionsCount)
98
+ return [`Only one assertion per test allowed, looks like you have none`, at];
99
+
99
100
  return [];
100
101
  }
101
102
 
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "supertape",
3
- "version": "6.9.4",
3
+ "version": "6.12.1",
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": {