tape-six 1.14.0 → 1.14.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.
- package/README.md +1 -2
- package/index.js +51 -44
- package/package.json +4 -4
- package/src/utils/EventServer.d.ts +5 -3
- package/src/utils/config.d.ts +6 -6
package/README.md
CHANGED
|
@@ -427,6 +427,7 @@ Test output can be controlled by flags. See [Supported flags](https://github.com
|
|
|
427
427
|
|
|
428
428
|
The most recent releases:
|
|
429
429
|
|
|
430
|
+
- 1.14.1 _Bug fixes. Updated dependencies._
|
|
430
431
|
- 1.14.0 _Internal housekeeping. Removed the Deno 2.9.0 workaround shim._
|
|
431
432
|
- 1.13.0 _TypeScript declarations for the `EventServer`._
|
|
432
433
|
- 1.12.0 _`tape6-server` is now pluggable, embeddable server for hermetic integration tests, runtime plugin registration, and an opt-in HTTP/2 mode._
|
|
@@ -455,5 +456,3 @@ The most recent releases:
|
|
|
455
456
|
- 1.5.0 _Internal refactoring (moved state to reporters), added type identification of values in the DOM and TTY reporters, multiple minor fixes._
|
|
456
457
|
|
|
457
458
|
The full release notes are in the wiki: [Release notes](https://github.com/uhop/tape-six/wiki/Release-notes).
|
|
458
|
-
|
|
459
|
-
For more info consult full [release notes](https://github.com/uhop/tape-six/wiki/Release-notes).
|
package/index.js
CHANGED
|
@@ -225,60 +225,67 @@ const getTestFileName = ({isBrowser, isBun, isDeno, isNode}) => {
|
|
|
225
225
|
let settings = null;
|
|
226
226
|
|
|
227
227
|
const testRunner = async () => {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
228
|
+
// ref'd keep-alive — a bare run holds no other ref'd handle, so a test awaiting
|
|
229
|
+
// only an unref'd timer (AbortSignal.timeout on Node/Bun) would exit 0 mid-suite
|
|
230
|
+
const keepAlive = setInterval(() => {}, 2 ** 31 - 1);
|
|
231
|
+
try {
|
|
232
|
+
if (!settings) {
|
|
233
|
+
await selectTimer();
|
|
234
|
+
settings = await init();
|
|
235
|
+
}
|
|
232
236
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
237
|
+
const {isBrowser, isCli} = settings,
|
|
238
|
+
reporter = getReporter(),
|
|
239
|
+
testFileName = getTestFileName(settings);
|
|
236
240
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
241
|
+
reporter.report({
|
|
242
|
+
type: 'test',
|
|
243
|
+
test: 0,
|
|
244
|
+
name: testFileName ? 'FILE: /' + testFileName : ''
|
|
245
|
+
});
|
|
242
246
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
247
|
+
reporter.state.beforeAll = getBeforeAll();
|
|
248
|
+
clearBeforeAll();
|
|
249
|
+
reporter.state.afterAll = getAfterAll();
|
|
250
|
+
clearAfterAll();
|
|
251
|
+
reporter.state.beforeEach = getBeforeEach();
|
|
252
|
+
clearBeforeEach();
|
|
253
|
+
reporter.state.afterEach = getAfterEach();
|
|
254
|
+
clearAfterEach();
|
|
255
|
+
reporter.state.isBeforeAllUsed = false;
|
|
252
256
|
|
|
253
|
-
|
|
257
|
+
const currentState = reporter.state;
|
|
254
258
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
259
|
+
for (;;) {
|
|
260
|
+
const tests = getTests();
|
|
261
|
+
if (!tests.length) break;
|
|
262
|
+
clearTests();
|
|
263
|
+
const canContinue = await runTests(tests);
|
|
264
|
+
if (!canContinue) break;
|
|
265
|
+
await new Promise(resolve => defer(resolve));
|
|
266
|
+
}
|
|
263
267
|
|
|
264
|
-
|
|
268
|
+
await currentState?.runAfterAll();
|
|
265
269
|
|
|
266
|
-
|
|
270
|
+
const runHasFailed = reporter.state && reporter.state.failed > 0;
|
|
267
271
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
272
|
+
reporter.report({
|
|
273
|
+
type: 'end',
|
|
274
|
+
test: 0,
|
|
275
|
+
name: testFileName ? 'FILE: /' + testFileName : '',
|
|
276
|
+
fail: runHasFailed
|
|
277
|
+
});
|
|
274
278
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
279
|
+
if (!getConfiguredFlag() && runHasFailed) {
|
|
280
|
+
if (isCli) {
|
|
281
|
+
process.exitCode = 1;
|
|
282
|
+
}
|
|
278
283
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
284
|
+
if (isBrowser && typeof __tape6_reportResults == 'function') {
|
|
285
|
+
__tape6_reportResults(runHasFailed ? 'failure' : 'success');
|
|
286
|
+
}
|
|
287
|
+
} finally {
|
|
288
|
+
clearInterval(keepAlive);
|
|
282
289
|
}
|
|
283
290
|
};
|
|
284
291
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tape-six",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.1",
|
|
4
4
|
"description": "TAP-inspired unit test library for Node, Deno, Bun, and browsers. ES modules, TypeScript, zero dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -101,8 +101,8 @@
|
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
|
-
"@types/node": "^26.1.
|
|
105
|
-
"prettier": "^3.9.
|
|
106
|
-
"typescript": "^
|
|
104
|
+
"@types/node": "^26.1.1",
|
|
105
|
+
"prettier": "^3.9.5",
|
|
106
|
+
"typescript": "^7.0.2"
|
|
107
107
|
}
|
|
108
108
|
}
|
|
@@ -21,13 +21,15 @@ export type TestEvent = {[key: string]: unknown};
|
|
|
21
21
|
*/
|
|
22
22
|
export interface EventServerReporter {
|
|
23
23
|
report(event: TestEvent, suppressStopTest?: boolean): void;
|
|
24
|
-
|
|
24
|
+
// no index signature: class-typed states (`State`) have none and must remain assignable
|
|
25
|
+
state?: {stopTest?: boolean} | null;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* Options consumed by the base class. Runners pass their own keys through
|
|
29
30
|
* (`flags`, `importmap`, `serverUrl`, `browser`, ...) — hence the index
|
|
30
|
-
* signature
|
|
31
|
+
* signature; `any`, not `unknown`, so checked-JS siblings read pass-through
|
|
32
|
+
* keys without casts (2026-07-10 decision, applies to all sidecar bags).
|
|
31
33
|
*/
|
|
32
34
|
export interface EventServerOptions {
|
|
33
35
|
/**
|
|
@@ -40,7 +42,7 @@ export interface EventServerOptions {
|
|
|
40
42
|
* `TAPE6_WORKER_TIMEOUT` via `getOptions()`.
|
|
41
43
|
*/
|
|
42
44
|
workerTimeout?: number;
|
|
43
|
-
[key: string]:
|
|
45
|
+
[key: string]: any;
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
/**
|
package/src/utils/config.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface Tape6Config {
|
|
|
27
27
|
cli?: string | string[];
|
|
28
28
|
browser?: string | string[];
|
|
29
29
|
importmap?: {imports: Record<string, string>};
|
|
30
|
-
[key: string]:
|
|
30
|
+
[key: string]: any;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/** Read `tape6.json`, else `package.json#tape6`, else the default patterns. */
|
|
@@ -74,19 +74,19 @@ export interface ArgOption {
|
|
|
74
74
|
initialValue?: string | null;
|
|
75
75
|
isValueRequired?: boolean;
|
|
76
76
|
/** Custom handler; mutate `flags` directly. */
|
|
77
|
-
fn?: (flags: Record<string,
|
|
77
|
+
fn?: (flags: Record<string, any>, name: string, value: string) => void;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
/** A bare function is shorthand for `{fn, isValueRequired: true}`. */
|
|
81
81
|
export type ArgOptions = Record<
|
|
82
82
|
string,
|
|
83
|
-
ArgOption | ((flags: Record<string,
|
|
83
|
+
ArgOption | ((flags: Record<string, any>, name: string, value: string) => void)
|
|
84
84
|
>;
|
|
85
85
|
|
|
86
86
|
/** Parse CLI args into files + flag values. CLI-only: in a browser returns an empty array. */
|
|
87
87
|
export const processArgs: (argOptions: ArgOptions) => {
|
|
88
88
|
files: string[];
|
|
89
|
-
flags: Record<string,
|
|
89
|
+
flags: Record<string, any>;
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
export interface RunnerFlags {
|
|
@@ -107,7 +107,7 @@ export interface RunnerFlags {
|
|
|
107
107
|
/** Consumed by the parent (`EventServer`) only; children ignore them. */
|
|
108
108
|
graceTimeout?: number;
|
|
109
109
|
workerTimeout?: number;
|
|
110
|
-
[key: string]:
|
|
110
|
+
[key: string]: any;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
export interface RunnerOptions {
|
|
@@ -115,7 +115,7 @@ export interface RunnerOptions {
|
|
|
115
115
|
parallel: number;
|
|
116
116
|
files: string[];
|
|
117
117
|
/** Raw parsed option values, keyed by canonical option name. */
|
|
118
|
-
optionFlags: Record<string,
|
|
118
|
+
optionFlags: Record<string, any>;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
/**
|