supertape 6.9.2 → 6.11.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,41 @@
1
+ 2022.01.04, v6.11.0
2
+
3
+ fix:
4
+ - (supertape) types: any -> unknown
5
+ - (@supertape/operator-stub) types: any -> unknown
6
+
7
+ feature:
8
+ - (package) yargs-parser v21.0.0
9
+ - (supertape) notOk: add ability to stringify content of passed value
10
+ - (package) putout v23.0.0
11
+ - (package) check-dts v0.6.5
12
+ - (package) check-dts v0.6.5
13
+ - (package) check-dts v0.6.5
14
+ - (@supertape/formatter-progress-bar) add color constant
15
+ - (package) eslint-plugin-putout v12.0.0
16
+ - (package) putout v22.0.0
17
+ - (package) check-dts v0.6.3
18
+ - (supertape) putout v21
19
+
20
+
21
+ 2021.10.23, v6.10.0
22
+
23
+ feature:
24
+ - (supertape) checkAssertionsCount: add ability to check that assertions count not less then one
25
+
26
+
27
+ 2021.10.19, v6.9.4
28
+
29
+ fix:
30
+ - (supertape) types: from/to -> result/expected
31
+
32
+
33
+ 2021.10.18, v6.9.3
34
+
35
+ fix:
36
+ - (supertape) types: TestOptions
37
+
38
+
1
39
  2021.10.07, v6.9.2
2
40
 
3
41
  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
 
@@ -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/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
 
@@ -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,9 +25,15 @@ 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
+
30
+ type TestOptions = {
31
+ checkAssertionsCount?: boolean,
32
+ checkScopes?: boolean,
33
+ checkDuplicates?: boolean,
34
+ };
29
35
 
30
- declare function test(message: string, fn: (t: Test) => void): void;
36
+ declare function test(message: string, fn: (t: Test) => void, options?: TestOptions): void;
31
37
  declare namespace test {
32
38
  export var only: typeof test;
33
39
  export var skip: typeof test;
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,6 +1,6 @@
1
1
  {
2
2
  "name": "supertape",
3
- "version": "6.9.2",
3
+ "version": "6.11.0",
4
4
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
5
5
  "description": "tape compatible test runner with superpowers",
6
6
  "homepage": "http://github.com/coderaiser/supertape",
@@ -61,7 +61,7 @@
61
61
  "strip-ansi": "^7.0.0",
62
62
  "try-to-catch": "^3.0.0",
63
63
  "wraptile": "^3.0.0",
64
- "yargs-parser": "^20.2.4"
64
+ "yargs-parser": "^21.0.0"
65
65
  },
66
66
  "keywords": [
67
67
  "function",
@@ -77,18 +77,19 @@
77
77
  "@babel/core": "^7.12.9",
78
78
  "@iocmd/wait": "^1.0.0",
79
79
  "c8": "^7.3.5",
80
- "check-dts": "^0.5.5",
80
+ "check-dts": "^0.6.5",
81
81
  "eslint": "^8.0.0-beta.0",
82
82
  "eslint-plugin-node": "^11.1.0",
83
- "eslint-plugin-putout": "^10.0.1",
83
+ "eslint-plugin-putout": "^12.0.0",
84
84
  "madrun": "^8.0.0",
85
85
  "mock-require": "^3.0.2",
86
86
  "montag": "^1.0.0",
87
87
  "nodemon": "^2.0.2",
88
88
  "pullout": "^4.0.0",
89
- "putout": "^20.0.1",
89
+ "putout": "^23.0.0",
90
90
  "runsome": "^1.0.0",
91
- "try-catch": "^3.0.0"
91
+ "try-catch": "^3.0.0",
92
+ "typescript": "^4.4.4"
92
93
  },
93
94
  "license": "MIT",
94
95
  "engines": {