supertape 8.0.1 → 8.2.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 +14 -0
- package/README.md +6 -59
- package/lib/operators.mjs +6 -2
- package/lib/supertape.d.ts +7 -2
- package/package.json +2 -2
package/ChangeLog
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
2022.11.14, v8.2.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- supertape: types: improve support of skip, only in WebStorm
|
|
5
|
+
- (package) putout v28.0.0
|
|
6
|
+
- (package) lerna v6.0.1
|
|
7
|
+
|
|
8
|
+
2022.09.15, v8.1.0
|
|
9
|
+
|
|
10
|
+
feature:
|
|
11
|
+
- supertape: add ability to return value from operator
|
|
12
|
+
- package: @supertape/operator-stub v3.0.0
|
|
13
|
+
- @supertape/operator-stub: type: Result -> OperationResult
|
|
14
|
+
|
|
1
15
|
2022.09.07, v8.0.1
|
|
2
16
|
|
|
3
17
|
feature:
|
package/README.md
CHANGED
|
@@ -17,13 +17,12 @@
|
|
|
17
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:
|
|
18
18
|
|
|
19
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](#
|
|
21
|
-
-
|
|
22
|
-
- the ability to [extend](#extending)
|
|
20
|
+
- a number of [built-in pretty output formatters](#formatters)
|
|
21
|
+
- the ability to [extend](#testextendextensions)
|
|
23
22
|
- 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
23
|
- detailed stack traces for `async` functions
|
|
25
|
-
- multiple [`test.only`'s](#
|
|
26
|
-
- [smart timeouts](#
|
|
24
|
+
- multiple [`test.only`'s](#testonlyname-cb)
|
|
25
|
+
- [smart timeouts](#environment-variables) for long running tests 🏃♂️
|
|
27
26
|
- more natural assertions: `expected, result` -> `result, expected`:
|
|
28
27
|
|
|
29
28
|
```js
|
|
@@ -92,7 +91,7 @@ Here is [result example](https://github.com/coderaiser/cloudcmd/commit/74d56f795
|
|
|
92
91
|
|
|
93
92
|
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
93
|
|
|
95
|
-
The following is a list of the base methods maintained by 📼 **Supertape**. Others, such as assertions for stubbing, are maintained in [
|
|
94
|
+
The following is a list of the base methods maintained by 📼 **Supertape**. Others, such as assertions for stubbing, are maintained in [special operators](#special-operators). To add custom assertion operators, see [Extending](#testextendextensions).
|
|
96
95
|
|
|
97
96
|
### Core Operators
|
|
98
97
|
|
|
@@ -140,7 +139,7 @@ Generates a failing assertion with `message` as a description.
|
|
|
140
139
|
|
|
141
140
|
#### `t.end()`
|
|
142
141
|
|
|
143
|
-
Declares the end of a test explicitly. Must be called exactly once per test. (See: [Single Call to `t.end()`](#single-
|
|
142
|
+
Declares the end of a test explicitly. Must be called exactly once per test. (See: [Single Call to `t.end()`](#single-tend))
|
|
144
143
|
|
|
145
144
|
#### `t.match(result: string, pattern: string | RegExp, message?: string)`
|
|
146
145
|
|
|
@@ -248,58 +247,6 @@ test('assertion', (t) => {
|
|
|
248
247
|
});
|
|
249
248
|
```
|
|
250
249
|
|
|
251
|
-
## t.end()
|
|
252
|
-
|
|
253
|
-
Declare the end of a test explicitly.
|
|
254
|
-
|
|
255
|
-
## t.fail(msg)
|
|
256
|
-
|
|
257
|
-
Generate a failing assertion with a message `msg`.
|
|
258
|
-
|
|
259
|
-
## t.pass(msg)
|
|
260
|
-
|
|
261
|
-
Generate a passing assertion with a message `msg`.
|
|
262
|
-
|
|
263
|
-
## t.ok(value, msg)
|
|
264
|
-
|
|
265
|
-
Assert that `value` is truthy with an optional description of the assertion `msg`.
|
|
266
|
-
|
|
267
|
-
## t.notOk(value, msg)
|
|
268
|
-
|
|
269
|
-
Assert that `value` is falsy with an optional description of the assertion `msg`.
|
|
270
|
-
|
|
271
|
-
## t.match(result, pattern[, msg])
|
|
272
|
-
|
|
273
|
-
Assert that `pattern: string | regexp` matches `result` with an optional description of the assertion `msg`.
|
|
274
|
-
|
|
275
|
-
## t.notMatch(result, pattern[, msg])
|
|
276
|
-
|
|
277
|
-
Assert that `pattern: string | regexp` not matches `result` with an optional description of the assertion `msg`.
|
|
278
|
-
|
|
279
|
-
## t.equal(result, expected, msg)
|
|
280
|
-
|
|
281
|
-
Assert that `Object.is(result, expected)` with an optional description of the assertion `msg`.
|
|
282
|
-
|
|
283
|
-
## t.notEqual(result, expected, msg)
|
|
284
|
-
|
|
285
|
-
Assert that `!Object.is(result, expected)` with an optional description of the assertion `msg`.
|
|
286
|
-
|
|
287
|
-
## t.deepEqual(result, expected, msg)
|
|
288
|
-
|
|
289
|
-
Assert that `result` and `expected` have the same structure and nested values using
|
|
290
|
-
[node's deepEqual() algorithm](https://github.com/substack/node-deep-equal)
|
|
291
|
-
with strict comparisons (`===`) on leaf nodes and an optional description of the assertion `msg`.
|
|
292
|
-
|
|
293
|
-
## t.notDeepEqual(result, expected, msg)
|
|
294
|
-
|
|
295
|
-
Assert that `result` and `expected` do not have the same structure and nested values using
|
|
296
|
-
[node's deepEqual() algorithm](https://github.com/substack/node-deep-equal)
|
|
297
|
-
with strict comparisons (`===`) on leaf nodes and an optional description of the assertion `msg`.
|
|
298
|
-
|
|
299
|
-
## t.comment(message)
|
|
300
|
-
|
|
301
|
-
Print a message without breaking the tap output. (Useful when using e.g. `tap-colorize` where output is buffered & `console.log` will print in incorrect order vis-a-vis tap output.)
|
|
302
|
-
|
|
303
250
|
## Example
|
|
304
251
|
|
|
305
252
|
```js
|
package/lib/operators.mjs
CHANGED
|
@@ -179,7 +179,9 @@ const initOperator = (runnerState) => (name) => {
|
|
|
179
179
|
return end;
|
|
180
180
|
|
|
181
181
|
const testState = await fn(...a);
|
|
182
|
-
|
|
182
|
+
run(name, runnerState, testState);
|
|
183
|
+
|
|
184
|
+
return testState;
|
|
183
185
|
};
|
|
184
186
|
|
|
185
187
|
return (...a) => {
|
|
@@ -193,7 +195,9 @@ const initOperator = (runnerState) => (name) => {
|
|
|
193
195
|
return end;
|
|
194
196
|
|
|
195
197
|
const testState = fn(...a);
|
|
196
|
-
|
|
198
|
+
run(name, runnerState, testState);
|
|
199
|
+
|
|
200
|
+
return testState;
|
|
197
201
|
};
|
|
198
202
|
};
|
|
199
203
|
|
package/lib/supertape.d.ts
CHANGED
|
@@ -39,9 +39,14 @@ type TestOptions = {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
declare function test(message: string, fn: (t: Test) => void, options?: TestOptions): void;
|
|
42
|
+
declare const skip: typeof test;
|
|
43
|
+
declare const only: typeof test;
|
|
44
|
+
|
|
42
45
|
declare namespace test {
|
|
43
|
-
export
|
|
44
|
-
|
|
46
|
+
export {
|
|
47
|
+
only,
|
|
48
|
+
skip,
|
|
49
|
+
};
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
export default test;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "supertape",
|
|
3
|
-
"version": "8.0
|
|
3
|
+
"version": "8.2.0",
|
|
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",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"montag": "^1.0.0",
|
|
88
88
|
"nodemon": "^2.0.2",
|
|
89
89
|
"pullout": "^4.0.0",
|
|
90
|
-
"putout": "^
|
|
90
|
+
"putout": "^28.0.0",
|
|
91
91
|
"runsome": "^1.0.0",
|
|
92
92
|
"try-catch": "^3.0.0",
|
|
93
93
|
"typescript": "^4.4.4"
|