supertape 13.2.0 β 13.3.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 +9 -0
- package/README.md +61 -81
- package/bin/subscribe.js +2 -4
- package/lib/env/index.js +6 -0
- package/lib/run-tests.js +4 -1
- package/package.json +2 -2
package/ChangeLog
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
2026.07.11, v13.3.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 2a006f1 @supertape/loader-ts: add
|
|
5
|
+
- daee6da @supertape/loader-jsx: oxc-transform v0.139.0
|
|
6
|
+
- 2010fcd @supertape/loader-jsx: oxc-transform v0.137.0
|
|
7
|
+
- 2f5fce1 supertape: runsome v2.0.1
|
|
8
|
+
- ef9f8a0 @supertape/loader-jsx: oxc-transform v0.136.0
|
|
9
|
+
|
|
1
10
|
2026.05.08, v13.2.0
|
|
2
11
|
|
|
3
12
|
feature:
|
package/README.md
CHANGED
|
@@ -19,45 +19,26 @@
|
|
|
19
19
|
πΌ **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:
|
|
20
20
|
|
|
21
21
|
- 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)
|
|
22
|
-
|
|
23
22
|
- a number of [built-in pretty output formatters](#formatters)
|
|
24
|
-
|
|
25
23
|
- the ability to [extend](#testextendextensions)
|
|
26
|
-
|
|
27
24
|
- 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
|
|
28
|
-
|
|
29
25
|
- detailed stack traces for `async` functions
|
|
30
|
-
|
|
31
26
|
- multiple [`test.only`'s](#testonlyname-cb)
|
|
32
|
-
|
|
33
27
|
- [smart timeouts](#environment-variables) for long running tests πββοΈ
|
|
34
|
-
|
|
35
|
-
- more natural assertions: `expected, result` -> `result, expected`:
|
|
36
|
-
|
|
37
|
-
```js
|
|
28
|
+
- more natural assertions: `expected, result` -> `result, expected`:```js
|
|
38
29
|
t.equal(error.message, 'hello world', `expected error.message to be 'hello world'`);
|
|
39
|
-
```
|
|
40
30
|
|
|
31
|
+
````
|
|
41
32
|
- ability to test files that imports css with:
|
|
42
33
|
|
|
43
34
|
```sh
|
|
44
35
|
NODE_OPTIONS="--import @supertape/loader-css" tape '{bin,lib}/**/*.spec.*'
|
|
45
|
-
|
|
36
|
+
````
|
|
46
37
|
|
|
47
38
|
Or in ποΈ[`madrun`](https://github.com/coderaiser/madrun):
|
|
48
39
|
|
|
49
40
|
```js
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const testEnv = defineEnv({
|
|
53
|
-
timeout: 7000,
|
|
54
|
-
css: true,
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
export default {
|
|
58
|
-
test: () => [testEnv, `tape 'lib/**/*.spec.js'`],
|
|
59
|
-
coverage: async () => [testEnv, `c8 ${await run('test')}`],
|
|
60
|
-
};
|
|
41
|
+
t.equal(error.message, 'hello world', `expected error.message to be 'hello world'`);
|
|
61
42
|
```
|
|
62
43
|
|
|
63
44
|
or jsx:
|
|
@@ -67,7 +48,7 @@ import {run, defineEnv} from 'supertape/env';
|
|
|
67
48
|
|
|
68
49
|
const testEnv = defineEnv({
|
|
69
50
|
timeout: 7000,
|
|
70
|
-
|
|
51
|
+
css: true,
|
|
71
52
|
});
|
|
72
53
|
|
|
73
54
|
export default {
|
|
@@ -84,7 +65,6 @@ import {run, defineEnv} from 'supertape/env';
|
|
|
84
65
|
const testEnv = defineEnv({
|
|
85
66
|
timeout: 7000,
|
|
86
67
|
jsx: true,
|
|
87
|
-
dom: true,
|
|
88
68
|
});
|
|
89
69
|
|
|
90
70
|
export default {
|
|
@@ -107,17 +87,18 @@ For a list of all built-in assertions, see [Operators](#operators).
|
|
|
107
87
|
You can use both **CommonJS** and **ESM**, here is **ESM** example:
|
|
108
88
|
|
|
109
89
|
```js
|
|
110
|
-
import {
|
|
111
|
-
|
|
112
|
-
const sump = (a, b) => a + b;
|
|
90
|
+
import {run, defineEnv} from 'supertape/env';
|
|
113
91
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
t.equal(result, expected);
|
|
119
|
-
t.end();
|
|
92
|
+
const testEnv = defineEnv({
|
|
93
|
+
timeout: 7000,
|
|
94
|
+
jsx: true,
|
|
95
|
+
dom: true,
|
|
120
96
|
});
|
|
97
|
+
|
|
98
|
+
export default {
|
|
99
|
+
test: () => [testEnv, `tape 'lib/**/*.spec.js'`],
|
|
100
|
+
coverage: async () => [testEnv, `c8 ${await run('test')}`],
|
|
101
|
+
};
|
|
121
102
|
```
|
|
122
103
|
|
|
123
104
|
## Install
|
|
@@ -151,8 +132,15 @@ Options
|
|
|
151
132
|
- `SUPERTAPE_LOAD_LOOP_TIMEOUT` - timeout for load tests, defaults to `5ms`, when mocha used as runner - `50ms` optimal;
|
|
152
133
|
|
|
153
134
|
```js
|
|
154
|
-
test
|
|
155
|
-
|
|
135
|
+
import {test} from 'supertape';
|
|
136
|
+
|
|
137
|
+
const sump = (a, b) => a + b;
|
|
138
|
+
|
|
139
|
+
test('calc: sum', (t) => {
|
|
140
|
+
const result = sum(1, 2);
|
|
141
|
+
const expected = 3;
|
|
142
|
+
|
|
143
|
+
t.equal(result, expected);
|
|
156
144
|
t.end();
|
|
157
145
|
});
|
|
158
146
|
```
|
|
@@ -244,7 +232,7 @@ To simplify the core of πΌ **Supertape**, other operators are maintained in se
|
|
|
244
232
|
Here is a list of built-int operators:
|
|
245
233
|
|
|
246
234
|
| Package | Version |
|
|
247
|
-
|
|
235
|
+
|---------|---------|
|
|
248
236
|
| [`@supertape/operator-stub`](/packages/operator-stub) | [](https://www.npmjs.com/package/@supertape/operator-stub) |
|
|
249
237
|
|
|
250
238
|
## Formatters
|
|
@@ -252,7 +240,7 @@ Here is a list of built-int operators:
|
|
|
252
240
|
There is a list of built-int `formatters` to customize output:
|
|
253
241
|
|
|
254
242
|
| Package | Version |
|
|
255
|
-
|
|
243
|
+
|---------|---------|
|
|
256
244
|
| [`@supertape/formatter-tap`](/packages/formatter-tap) | [](https://www.npmjs.com/package/@supertape/formatter-tap) |
|
|
257
245
|
| [`@supertape/formatter-fail`](/packages/formatter-fail) | [](https://www.npmjs.com/package/@supertape/formatter-fail) |
|
|
258
246
|
| [`@supertape/formatter-short`](/packages/formatter-short) | [](https://www.npmjs.com/package/@supertape/formatter-short) |
|
|
@@ -263,8 +251,7 @@ There is a list of built-int `formatters` to customize output:
|
|
|
263
251
|
|
|
264
252
|
### test(message: string, fn: (t: Test) => void, options?: TestOptions)
|
|
265
253
|
|
|
266
|
-
Create a new test with `message` string
|
|
267
|
-
`fn(t)` fires with the new test object `t` once all preceding tests have
|
|
254
|
+
Create a new test with `message` string.`fn(t)` fires with the new test object `t` once all preceding tests have
|
|
268
255
|
finished. Tests execute serially.
|
|
269
256
|
|
|
270
257
|
Here is Possible `options` similar to [Environment Variables](#environment-variables) but relates to one test:
|
|
@@ -275,8 +262,8 @@ Here is Possible `options` similar to [Environment Variables](#environment-varia
|
|
|
275
262
|
- `timeout`;
|
|
276
263
|
|
|
277
264
|
```js
|
|
278
|
-
test('
|
|
279
|
-
t.equal(
|
|
265
|
+
test('tape: error', (t) => {
|
|
266
|
+
t.equal(error.code, 'ENOENT');
|
|
280
267
|
t.end();
|
|
281
268
|
});
|
|
282
269
|
```
|
|
@@ -295,6 +282,17 @@ Generate a new test that will be skipped over.
|
|
|
295
282
|
|
|
296
283
|
Extend base assertions with more:
|
|
297
284
|
|
|
285
|
+
```js
|
|
286
|
+
test('hello: world', (t) => {
|
|
287
|
+
t.equal('hello', 'world');
|
|
288
|
+
t.end();
|
|
289
|
+
});
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### `isOnlyTests`
|
|
293
|
+
|
|
294
|
+
When you need to know if there was `only` tests use:
|
|
295
|
+
|
|
298
296
|
```js
|
|
299
297
|
import {extend} from 'supertape';
|
|
300
298
|
|
|
@@ -315,9 +313,9 @@ test('assertion', (t) => {
|
|
|
315
313
|
});
|
|
316
314
|
```
|
|
317
315
|
|
|
318
|
-
### `
|
|
316
|
+
### `isSkipTests`
|
|
319
317
|
|
|
320
|
-
When you need to know if there was `
|
|
318
|
+
When you need to know if there was `skip` tests use:
|
|
321
319
|
|
|
322
320
|
```js
|
|
323
321
|
import {isOnlyTests} from 'supertape';
|
|
@@ -325,9 +323,9 @@ import {isOnlyTests} from 'supertape';
|
|
|
325
323
|
isOnlyTests();
|
|
326
324
|
```
|
|
327
325
|
|
|
328
|
-
### `
|
|
326
|
+
### `isFailTests`
|
|
329
327
|
|
|
330
|
-
When you need to know if there was `
|
|
328
|
+
When you need to know if there was `failed` tests use:
|
|
331
329
|
|
|
332
330
|
```js
|
|
333
331
|
import {isSkipTests} from 'supertape';
|
|
@@ -335,9 +333,9 @@ import {isSkipTests} from 'supertape';
|
|
|
335
333
|
isSkipTests();
|
|
336
334
|
```
|
|
337
335
|
|
|
338
|
-
### `
|
|
336
|
+
### `callWhenTestsEnds`
|
|
339
337
|
|
|
340
|
-
|
|
338
|
+
Call your function when tests ends (usually on 'process.exit')
|
|
341
339
|
|
|
342
340
|
```js
|
|
343
341
|
import {isFailTests} from 'supertape';
|
|
@@ -345,9 +343,7 @@ import {isFailTests} from 'supertape';
|
|
|
345
343
|
isFailTests();
|
|
346
344
|
```
|
|
347
345
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
Call your function when tests ends (usually on 'process.exit')
|
|
346
|
+
## Example
|
|
351
347
|
|
|
352
348
|
```js
|
|
353
349
|
import {callWhenTestsEnds} from 'supertape';
|
|
@@ -357,7 +353,20 @@ callWhenTestsEnds('TYPE_CHECK', () => {
|
|
|
357
353
|
});
|
|
358
354
|
```
|
|
359
355
|
|
|
360
|
-
##
|
|
356
|
+
## πͺExit Codes
|
|
357
|
+
|
|
358
|
+
πΌ**Supertape** can have one of next [exit codes](https://github.com/coderaiser/supertape/blob/master/packages/supertape/lib/exit-codes.js):
|
|
359
|
+
|
|
360
|
+
| Code | Name | Description |
|
|
361
|
+
|------|------------------|--------------------------------------------------------------------------------------|
|
|
362
|
+
| 0 | `OK` | no errors found |
|
|
363
|
+
| 1 | `FAIL` | test failed |
|
|
364
|
+
| 2 | `WAS_STOP` | test was halted by user |
|
|
365
|
+
| 3 | `UNHANDLED` | unhandled exception occurred |
|
|
366
|
+
| 4 | `INVALID_OPTION` | wrong option provided |
|
|
367
|
+
| 5 | `SKIPPED` | works only with `SUPERTAPE_CHECK_SKIPPED` env variable when skipped files 1 and more |
|
|
368
|
+
|
|
369
|
+
Here is how exit code can look like:
|
|
361
370
|
|
|
362
371
|
```js
|
|
363
372
|
import {test} from 'supertape';
|
|
@@ -372,7 +381,6 @@ test('lib: diff', (t) => {
|
|
|
372
381
|
t.equal({}, {hello: 'world'}, 'should equal');
|
|
373
382
|
t.end();
|
|
374
383
|
});
|
|
375
|
-
|
|
376
384
|
// output
|
|
377
385
|
`
|
|
378
386
|
- Expected
|
|
@@ -385,34 +393,6 @@ test('lib: diff', (t) => {
|
|
|
385
393
|
`;
|
|
386
394
|
```
|
|
387
395
|
|
|
388
|
-
## πͺExit Codes
|
|
389
|
-
|
|
390
|
-
πΌ**Supertape** can have one of next [exit codes](https://github.com/coderaiser/supertape/blob/master/packages/supertape/lib/exit-codes.js):
|
|
391
|
-
|
|
392
|
-
| Code | Name | Description |
|
|
393
|
-
|------|------|-----------------|
|
|
394
|
-
| 0 | `OK` | no errors found |
|
|
395
|
-
| 1 | `FAIL` | test failed |
|
|
396
|
-
| 2 | `WAS_STOP` | test was halted by user |
|
|
397
|
-
| 3 | `UNHANDLED`| unhandled exception occurred |
|
|
398
|
-
| 4 | `INVALID_OPTION`| wrong option provided |
|
|
399
|
-
| 5 | `SKIPPED` | works only with `SUPERTAPE_CHECK_SKIPPED` env variable when skipped files 1 and more |
|
|
400
|
-
|
|
401
|
-
Here is how exit code can look like:
|
|
402
|
-
|
|
403
|
-
```js
|
|
404
|
-
import {SKIPPED} from 'supertape/exit-codes';
|
|
405
|
-
|
|
406
|
-
const env = {
|
|
407
|
-
ESCOVER_SUCCESS_EXIT_CODE: SKIPPED,
|
|
408
|
-
SUPERTAPE_CHECK_SKIPPED: 1,
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
export default {
|
|
412
|
-
test: () => [env, `escover tape 'test/**/*.js' 'lib/**/*.spec.js'`],
|
|
413
|
-
};
|
|
414
|
-
```
|
|
415
|
-
|
|
416
396
|
## License
|
|
417
397
|
|
|
418
398
|
MIT
|
package/bin/subscribe.js
CHANGED
|
@@ -7,8 +7,6 @@ import {
|
|
|
7
7
|
CONSOLE_ERROR,
|
|
8
8
|
} from '../lib/worker/create-console-log.js';
|
|
9
9
|
|
|
10
|
-
const one = (fn) => (a) => fn(a);
|
|
11
|
-
|
|
12
10
|
const maybeParse = (a) => a && parse(a);
|
|
13
11
|
const {createHarness} = harnessCreator;
|
|
14
12
|
const resolveFormatter = async (name) => await import(`@supertape/formatter-${name}`);
|
|
@@ -43,7 +41,7 @@ export async function subscribe({name, exit, worker, stdout}) {
|
|
|
43
41
|
export function consoleLog({message, logger = console}) {
|
|
44
42
|
const messages = message
|
|
45
43
|
.split(SPLITTER)
|
|
46
|
-
.map(
|
|
44
|
+
.map(maybeParse);
|
|
47
45
|
|
|
48
46
|
logger.log(...messages);
|
|
49
47
|
}
|
|
@@ -51,7 +49,7 @@ export function consoleLog({message, logger = console}) {
|
|
|
51
49
|
export function consoleError({message, logger = console}) {
|
|
52
50
|
const messages = message
|
|
53
51
|
.split(SPLITTER)
|
|
54
|
-
.map(
|
|
52
|
+
.map(maybeParse);
|
|
55
53
|
|
|
56
54
|
logger.error(...messages);
|
|
57
55
|
}
|
package/lib/env/index.js
CHANGED
|
@@ -37,6 +37,12 @@ export const defineEnv = (config, overrides = {}) => {
|
|
|
37
37
|
continue;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
if (key === 'ts' && value) {
|
|
41
|
+
localEnv += ` ${addLoader('ts')}`;
|
|
42
|
+
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
|
|
40
46
|
const name = `SUPERTAPE_${justSnakeCase(key).toUpperCase()}`;
|
|
41
47
|
|
|
42
48
|
result[name] = parseValue(value);
|
package/lib/run-tests.js
CHANGED
|
@@ -196,7 +196,10 @@ async function runOneTest(options) {
|
|
|
196
196
|
isDebug,
|
|
197
197
|
});
|
|
198
198
|
|
|
199
|
-
const [error] = await Promise.race([
|
|
199
|
+
const [error] = await Promise.race([
|
|
200
|
+
tryToCatch(fn, t),
|
|
201
|
+
timer,
|
|
202
|
+
]);
|
|
200
203
|
|
|
201
204
|
stopTimer();
|
|
202
205
|
isEnded(false);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "supertape",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.3.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",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"nodemon": "^3.0.1",
|
|
89
89
|
"pullout": "^5.0.1",
|
|
90
90
|
"putout": "^42.0.17",
|
|
91
|
-
"runsome": "^
|
|
91
|
+
"runsome": "^2.0.1",
|
|
92
92
|
"superc8": "^12.0.0",
|
|
93
93
|
"try-catch": "^4.0.2",
|
|
94
94
|
"typescript": "^6.0.2"
|