supertape 6.9.3 → 6.12.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,45 @@
1
+ 2022.01.14, v6.12.0
2
+
3
+ feature:
4
+ - (supertape) get rid of simport
5
+ - (package) putout v24.1.0
6
+ - (package) eslint-plugin-putout v13.0.1
7
+ - (@supertape/engine-loader) get rid of simport
8
+ - (@supertape/formatter-progress-bar) add newline befor fail count
9
+
10
+
11
+ 2022.01.04, v6.11.0
12
+
13
+ fix:
14
+ - (supertape) types: any -> unknown
15
+ - (@supertape/operator-stub) types: any -> unknown
16
+
17
+ feature:
18
+ - (package) yargs-parser v21.0.0
19
+ - (supertape) notOk: add ability to stringify content of passed value
20
+ - (package) putout v23.0.0
21
+ - (package) check-dts v0.6.5
22
+ - (package) check-dts v0.6.5
23
+ - (package) check-dts v0.6.5
24
+ - (@supertape/formatter-progress-bar) add color constant
25
+ - (package) eslint-plugin-putout v12.0.0
26
+ - (package) putout v22.0.0
27
+ - (package) check-dts v0.6.3
28
+ - (supertape) putout v21
29
+
30
+
31
+ 2021.10.23, v6.10.0
32
+
33
+ feature:
34
+ - (supertape) checkAssertionsCount: add ability to check that assertions count not less then one
35
+
36
+
37
+ 2021.10.19, v6.9.4
38
+
39
+ fix:
40
+ - (supertape) types: from/to -> result/expected
41
+
42
+
1
43
  2021.10.18, v6.9.3
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
@@ -8,9 +8,7 @@ const glob = require('glob');
8
8
  const fullstore = require('fullstore');
9
9
  const tryToCatch = require('try-to-catch');
10
10
  const keypress = require('@putout/cli-keypress');
11
- const {createSimport} = require('simport');
12
-
13
- const simport = createSimport(__filename);
11
+ const {simpleImport} = require('./simple-import');
14
12
 
15
13
  const supertape = require('..');
16
14
  const {
@@ -21,7 +19,6 @@ const {
21
19
  INVALID_OPTION,
22
20
  } = require('./exit-codes');
23
21
 
24
- const {resolve} = require;
25
22
  const {isArray} = Array;
26
23
 
27
24
  const maybeFirst = (a) => isArray(a) ? a.pop() : a;
@@ -119,7 +116,7 @@ async function cli({argv, cwd, stdout, isStop}) {
119
116
  }
120
117
 
121
118
  if (args.help) {
122
- const help = await simport('./help.js');
119
+ const {help} = await import('./help.js');
123
120
  stdout.write(help());
124
121
  return OK;
125
122
  }
@@ -138,9 +135,7 @@ async function cli({argv, cwd, stdout, isStop}) {
138
135
  };
139
136
 
140
137
  for (const module of args.require)
141
- await simport(resolve(module, {
142
- paths: [cwd],
143
- }));
138
+ await import(module);
144
139
 
145
140
  const allFiles = [];
146
141
  for (const arg of args._) {
@@ -171,7 +166,7 @@ async function cli({argv, cwd, stdout, isStop}) {
171
166
  const files = removeDuplicates(allFiles);
172
167
 
173
168
  for (const file of files) {
174
- promises.push(simport(resolvePath(cwd, file)));
169
+ promises.push(simpleImport(resolvePath(cwd, file)));
175
170
  }
176
171
 
177
172
  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,16 +7,16 @@ 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
- equal: (from: unknown, to: unknown, message?: string) => Result;
17
- notEqual: (from: unknown, to: unknown, message?: string) => Result;
18
- deepEqual: (from: unknown, to: unknown, message?: string) => Result;
19
- notDeepEqual: (from: unknown, to: unknown, message?: string) => Result;
16
+ equal: (result: unknown, expected: unknown, message?: string) => Result;
17
+ notEqual: (result: unknown, expected: unknown, message?: string) => Result;
18
+ deepEqual: (result: unknown, expected: unknown, message?: string) => Result;
19
+ notDeepEqual: (result: unknown, expected: unknown, message?: string) => Result;
20
20
  fail: (message: string) => Result;
21
21
  pass: (message: string) => Result;
22
22
  ok: (result: boolean | 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.3",
3
+ "version": "6.12.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": {