supertape 8.0.0 → 8.0.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.
Files changed (3) hide show
  1. package/ChangeLog +7 -0
  2. package/README.md +93 -22
  3. package/package.json +3 -3
package/ChangeLog CHANGED
@@ -1,3 +1,10 @@
1
+ 2022.09.07, v8.0.1
2
+
3
+ feature:
4
+ - package: @supertape/operator-stub v3.0.0
5
+ - @supertape/operator-stub: type: Result -> OperationResult
6
+ - (package) supertape v8.0.0
7
+
1
8
  2022.09.07, v8.0.0
2
9
 
3
10
  fix:
package/README.md CHANGED
@@ -1,38 +1,43 @@
1
- # 📼 Supertape [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]
1
+ # 📼 Supertape [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL] [![License: MIT][MITLicenseIMGURL]][MITLicenseURL]
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
- [BuildStatusURL]: https://github.com/coderaiser/putout/actions?query=workflow%3A%22Node+CI%22 "Build Status"
6
- [BuildStatusIMGURL]: https://github.com/coderaiser/putout/workflows/Node%20CI/badge.svg
5
+ [BuildStatusURL]: https://github.com/coderaiser/supertape/actions?query=workflow%3A%22Node+CI%22 "Build Status"
6
+ [BuildStatusIMGURL]: https://github.com/coderaiser/supertape/workflows/Node%20CI/badge.svg
7
7
  [BuildStatusURL]: https://travis-ci.org/coderaiser/supertape "Build Status"
8
8
  [CoverageURL]: https://coveralls.io/github/coderaiser/supertape?branch=master
9
9
  [CoverageIMGURL]: https://coveralls.io/repos/coderaiser/supertape/badge.svg?branch=master&service=github
10
+ [MITLicenseURL]: https://opensource.org/licenses/MIT
11
+ [MITLicenseIMGURL]: https://img.shields.io/badge/License-MIT-green.svg
10
12
 
11
13
  [![supertape](https://asciinema.org/a/Cgc3rDOfZAeDnJSxzEYpPfBMY.svg)](https://asciinema.org/a/Cgc3rDOfZAeDnJSxzEYpPfBMY)
12
14
 
13
- [Tape](https://github.com/substack/tape)-inspired [TAP](https://testanything.org/)-compatible simplest high speed test runner with superpowers.
15
+ [**Tape**](https://github.com/substack/tape)-inspired [`TAP`](https://testanything.org/)-compatible simplest high speed test runner with superpowers.
14
16
 
15
- 📼`Supertape` written from scratch after messing a lot with `tape`, it willing to be compatible with it as much as possible.
16
- and has a couple differences. It contains:
17
+ 📼 **Supertape** is a fast, minimal test runner with the soul of **tape**. It's designed to be as compatible as possible with **tape** while still having some key improvements, such as:
17
18
 
18
- - ability to work with [esm modules](https://nodejs.org/api/esm.html) (take a look at [mock-import](https://github.com/coderaiser/mock-import) for mocking).
19
- - shows colored diff when test not `equal` or not `deepEqual`;
20
- - produces deteiled stack traces for `async functions`;
21
- - as many `only` as you wish;
22
- - ability to extend;
23
- - smart timeouts for long running tests 🏃‍♂️(configured with `SUPERTAPE_TIMEOUT`);
24
- - outputs `result` instead of `actual`;
25
- - more natural assertions: `expected, result` -> `result, expected`, for example:
19
+ - the ability to work with [ESM Modules](https://nodejs.org/api/esm.html) (take a look at [mock-import](https://github.com/coderaiser/mock-import) for mocking and 🎩[ESCover](https://github.com/coderaiser/escover) for coverage)
20
+ - a number of [built-in pretty output formatters](#formatting)
21
+ - easy [configuration](#list-of-options)
22
+ - the ability to [extend](#extending)
23
+ - showing colored diff when using the [`t.equal()`](#tequalresult-any-expected-any-message-string) and [`t.deepEqual()`](#tdeepequalresult-any-expected-any-message-string) assertion operators
24
+ - detailed stack traces for `async` functions
25
+ - multiple [`test.only`'s](#testonlymessage-string-fn-t-test--void-options-testoptions)
26
+ - [smart timeouts](#supertape_timeout) for long running tests 🏃‍♂️
27
+ - more natural assertions: `expected, result` -> `result, expected`:
26
28
 
27
- ```js
28
- t.equal(error.message, 'hello world', `expected error.message to be 'hello world'`);
29
- ```
29
+ ```js
30
+ t.equal(error.message, 'hello world', `expected error.message to be 'hello world'`);
31
+ ```
32
+
33
+ 📼 **Supertape** doesn't contain:
30
34
 
31
- Doesn't contain:
35
+ - assertion aliases, making the available operators far more concise
36
+ - `es3 code` and lot's of [ponyfills](https://github.com/sindresorhus/ponyfill#how-are-ponyfills-better-than-polyfills)
37
+ - `t.throws()`, `t.doesNotThrow()` - use [**tryCatch**](https://github.com/coderaiser/try-catch) or [**tryToCatch**](https://github.com/coderaiser/try-to-catch) with [`t.equal()`](#tequalresult-any-expected-any-message-string) instead
38
+ - [`t.plan()`](https://github.com/substack/tape#tplann)
32
39
 
33
- - `es3 code` and lot's of [ponyfills](https://github.com/sindresorhus/ponyfill#how-are-ponyfills-better-than-polyfills).
34
- - aliases, methods list much shorter;
35
- - `throws`, `doesNotThrows` - use [tryCatch](https://github.com/coderaiser/try-catch), [tryToCatch](https://github.com/coderaiser/try-to-catch) with `equal` instead.
40
+ For a list of all built-in assertions, see [Operators](#operators).
36
41
 
37
42
  ## Install
38
43
 
@@ -85,7 +90,73 @@ Here is [result example](https://github.com/coderaiser/cloudcmd/commit/74d56f795
85
90
 
86
91
  ## Operators
87
92
 
88
- To simplify `supertape` core operators located in separate packages, called `operators`:
93
+ The assertion methods of 📼 **Supertape** are heavily influenced by [**tape**](https://github.com/substack/tape). However, to keep a minimal core of assertions, there are no aliases and some superfluous operators have been removed (such as `t.throws()`).
94
+
95
+ The following is a list of the base methods maintained by 📼 **Supertape**. Others, such as assertions for stubbing, are maintained in [separate packages](#other-built-in-operators). To add custom assertion operators, see [Extending](#extending).
96
+
97
+ ### Core Operators
98
+
99
+ #### `t.equal(result: any, expected: any, message?: string)`
100
+
101
+ Asserts that `result` and `expected` are strictly equal. If `message` is provided, it will be outputted as a description of the assertion.
102
+
103
+ *Note: uses `Object.is(result, expected)`*
104
+
105
+ #### `t.notEqual(result: any, expected: any, message?: string)`
106
+
107
+ Asserts that `result` and `expected` are not strictly equal. If `message` is provided, it will be outputted as a description of the assertion.
108
+
109
+ *Note: uses `!Object.is(result, expected)`*
110
+
111
+ #### `t.deepEqual(result: any, expected: any, message?: string)`
112
+
113
+ Asserts that `result` and `expected` are loosely equal, with the same structure and nested values. If `message` is provided, it will be outputted as a description of the assertion.
114
+
115
+ *Note: uses [node's deepEqual() algorithm][NodeDeepEqual] with strict comparisons (`===`) on leaf nodes*
116
+
117
+ #### `t.notDeepEqual(result: any, expected: any, message?: string)`
118
+
119
+ Asserts that `result` and `expected` not loosely equal, with different structure and/or nested values. If `message` is provided, it will be outputted as a description of the assertion.
120
+
121
+ *Note: uses [node's deepEqual() algorithm][NodeDeepEqual] with strict comparisons (`===`) on leaf nodes*
122
+
123
+ [NodeDeepEqual]: https://github.com/substack/node-deep-equal
124
+
125
+ #### `t.ok(result: boolean | any, message?: string)`
126
+
127
+ Asserts that `result` is truthy. If `message` is provided, it will be outputted as a description of the assertion.
128
+
129
+ #### `t.notOk(result: boolean | any, message?: string)`
130
+
131
+ Asserts that `result` is falsy. If `message` is provided, it will be outputted as a description of the assertion.
132
+
133
+ #### `t.pass(message: string)`
134
+
135
+ Generates a passing assertion with `message` as a description.
136
+
137
+ #### `t.fail(message: string)`
138
+
139
+ Generates a failing assertion with `message` as a description.
140
+
141
+ #### `t.end()`
142
+
143
+ Declares the end of a test explicitly. Must be called exactly once per test. (See: [Single Call to `t.end()`](#single-call-to-tend))
144
+
145
+ #### `t.match(result: string, pattern: string | RegExp, message?: string)`
146
+
147
+ Asserts that `result` matches the regex `pattern`. If `pattern` is not a valid regex, the assertion fails. If `message` is provided, it will be outputted as a description of the assertion.
148
+
149
+ #### `t.notMatch(result: string, pattern: string | RegExp, message?: string)`
150
+
151
+ Asserts that `result` does not match the regex `pattern`. If `pattern` is not a valid regex, the assertion always fails. If `message` is provided, it will be outputted as a description of the assertion.
152
+
153
+ #### `t.comment(message: string)`
154
+
155
+ Print a message without breaking the `TAP` output. Useful when using a `tap`-reporter such as `tap-colorize`, where the output is buffered and `console.log()` will print in incorrect order vis-a-vis `TAP` output.
156
+
157
+ ### Special Operators
158
+
159
+ To simplify the core of 📼 **Supertape**, other operators are maintained in separate packages. The following is a list of all such packages:
89
160
 
90
161
  Here is a list of built-int operators:
91
162
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supertape",
3
- "version": "8.0.0",
3
+ "version": "8.0.1",
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",
@@ -49,7 +49,7 @@
49
49
  "@supertape/formatter-progress-bar": "^3.0.0",
50
50
  "@supertape/formatter-short": "^2.0.0",
51
51
  "@supertape/formatter-tap": "^3.0.0",
52
- "@supertape/operator-stub": "^2.0.0",
52
+ "@supertape/operator-stub": "^3.0.0",
53
53
  "cli-progress": "^3.8.2",
54
54
  "deep-equal": "^2.0.3",
55
55
  "fullstore": "^3.0.0",
@@ -79,7 +79,7 @@
79
79
  "c8": "^7.3.5",
80
80
  "check-dts": "^0.6.5",
81
81
  "eslint": "^8.0.0",
82
- "eslint-plugin-node": "^11.1.0",
82
+ "eslint-plugin-n": "^15.2.5",
83
83
  "eslint-plugin-putout": "^16.0.1",
84
84
  "find-up": "^6.3.0",
85
85
  "madrun": "^9.0.0",