omegon 0.8.3 → 0.9.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/extensions/cleave/dispatcher.ts +213 -20
- package/extensions/cleave/index.ts +24 -8
- package/extensions/cleave/rpc-child.ts +269 -0
- package/extensions/cleave/types.ts +52 -0
- package/extensions/openspec/spec.ts +3 -0
- package/node_modules/@types/node/README.md +3 -3
- package/node_modules/@types/node/assert/strict.d.ts +11 -5
- package/node_modules/@types/node/assert.d.ts +173 -50
- package/node_modules/@types/node/async_hooks.d.ts +8 -28
- package/node_modules/@types/node/buffer.buffer.d.ts +7 -1
- package/node_modules/@types/node/buffer.d.ts +168 -44
- package/node_modules/@types/node/child_process.d.ts +70 -27
- package/node_modules/@types/node/cluster.d.ts +332 -240
- package/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
- package/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- package/node_modules/@types/node/compatibility/iterators.d.ts +0 -1
- package/node_modules/@types/node/console.d.ts +350 -49
- package/node_modules/@types/node/constants.d.ts +4 -3
- package/node_modules/@types/node/crypto.d.ts +1110 -630
- package/node_modules/@types/node/dgram.d.ts +51 -15
- package/node_modules/@types/node/diagnostics_channel.d.ts +6 -4
- package/node_modules/@types/node/dns/promises.d.ts +4 -4
- package/node_modules/@types/node/dns.d.ts +133 -132
- package/node_modules/@types/node/domain.d.ts +17 -13
- package/node_modules/@types/node/events.d.ts +663 -734
- package/node_modules/@types/node/fs/promises.d.ts +9 -43
- package/node_modules/@types/node/fs.d.ts +411 -628
- package/node_modules/@types/node/globals.d.ts +30 -8
- package/node_modules/@types/node/globals.typedarray.d.ts +0 -63
- package/node_modules/@types/node/http.d.ts +265 -364
- package/node_modules/@types/node/http2.d.ts +715 -551
- package/node_modules/@types/node/https.d.ts +239 -65
- package/node_modules/@types/node/index.d.ts +6 -24
- package/node_modules/@types/node/inspector.d.ts +53 -69
- package/node_modules/@types/node/inspector.generated.d.ts +410 -759
- package/node_modules/@types/node/module.d.ts +186 -52
- package/node_modules/@types/node/net.d.ts +194 -70
- package/node_modules/@types/node/os.d.ts +11 -12
- package/node_modules/@types/node/package.json +3 -13
- package/node_modules/@types/node/path.d.ts +133 -120
- package/node_modules/@types/node/perf_hooks.d.ts +643 -318
- package/node_modules/@types/node/process.d.ts +132 -223
- package/node_modules/@types/node/punycode.d.ts +5 -5
- package/node_modules/@types/node/querystring.d.ts +4 -4
- package/node_modules/@types/node/readline/promises.d.ts +3 -3
- package/node_modules/@types/node/readline.d.ts +120 -68
- package/node_modules/@types/node/repl.d.ts +100 -87
- package/node_modules/@types/node/sea.d.ts +1 -10
- package/node_modules/@types/node/sqlite.d.ts +19 -363
- package/node_modules/@types/node/stream/consumers.d.ts +10 -10
- package/node_modules/@types/node/stream/promises.d.ts +15 -136
- package/node_modules/@types/node/stream/web.d.ts +502 -176
- package/node_modules/@types/node/stream.d.ts +475 -581
- package/node_modules/@types/node/string_decoder.d.ts +4 -4
- package/node_modules/@types/node/test.d.ts +196 -308
- package/node_modules/@types/node/timers/promises.d.ts +4 -4
- package/node_modules/@types/node/timers.d.ts +132 -4
- package/node_modules/@types/node/tls.d.ts +226 -110
- package/node_modules/@types/node/trace_events.d.ts +9 -9
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +7 -1
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -2
- package/node_modules/@types/node/ts5.6/index.d.ts +6 -26
- package/node_modules/@types/node/tty.d.ts +16 -58
- package/node_modules/@types/node/url.d.ts +573 -130
- package/node_modules/@types/node/util.d.ts +1100 -181
- package/node_modules/@types/node/v8.d.ts +8 -76
- package/node_modules/@types/node/vm.d.ts +72 -280
- package/node_modules/@types/node/wasi.d.ts +4 -25
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +2 -27
- package/node_modules/@types/node/web-globals/events.d.ts +0 -9
- package/node_modules/@types/node/web-globals/fetch.d.ts +0 -14
- package/node_modules/@types/node/web-globals/navigator.d.ts +0 -3
- package/node_modules/@types/node/worker_threads.d.ts +335 -268
- package/node_modules/@types/node/zlib.d.ts +74 -9
- package/node_modules/undici-types/agent.d.ts +12 -13
- package/node_modules/undici-types/api.d.ts +26 -26
- package/node_modules/undici-types/balanced-pool.d.ts +12 -13
- package/node_modules/undici-types/client.d.ts +19 -19
- package/node_modules/undici-types/connector.d.ts +2 -2
- package/node_modules/undici-types/cookies.d.ts +0 -2
- package/node_modules/undici-types/diagnostics-channel.d.ts +10 -18
- package/node_modules/undici-types/dispatcher.d.ts +103 -123
- package/node_modules/undici-types/env-http-proxy-agent.d.ts +3 -4
- package/node_modules/undici-types/errors.d.ts +54 -66
- package/node_modules/undici-types/eventsource.d.ts +4 -9
- package/node_modules/undici-types/fetch.d.ts +20 -22
- package/node_modules/undici-types/file.d.ts +39 -0
- package/node_modules/undici-types/filereader.d.ts +54 -0
- package/node_modules/undici-types/formdata.d.ts +7 -7
- package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
- package/node_modules/undici-types/global-origin.d.ts +5 -5
- package/node_modules/undici-types/handlers.d.ts +8 -8
- package/node_modules/undici-types/header.d.ts +1 -157
- package/node_modules/undici-types/index.d.ts +47 -64
- package/node_modules/undici-types/interceptors.d.ts +8 -64
- package/node_modules/undici-types/mock-agent.d.ts +18 -36
- package/node_modules/undici-types/mock-client.d.ts +4 -6
- package/node_modules/undici-types/mock-errors.d.ts +3 -3
- package/node_modules/undici-types/mock-interceptor.d.ts +20 -21
- package/node_modules/undici-types/mock-pool.d.ts +4 -6
- package/node_modules/undici-types/package.json +1 -1
- package/node_modules/undici-types/patch.d.ts +4 -0
- package/node_modules/undici-types/pool-stats.d.ts +8 -8
- package/node_modules/undici-types/pool.d.ts +13 -15
- package/node_modules/undici-types/proxy-agent.d.ts +4 -5
- package/node_modules/undici-types/readable.d.ts +16 -19
- package/node_modules/undici-types/retry-agent.d.ts +1 -1
- package/node_modules/undici-types/retry-handler.d.ts +10 -19
- package/node_modules/undici-types/util.d.ts +3 -3
- package/node_modules/undici-types/webidl.d.ts +29 -142
- package/node_modules/undici-types/websocket.d.ts +10 -46
- package/package.json +2 -1
- package/skills/cleave/SKILL.md +62 -2
- package/node_modules/@types/node/inspector/promises.d.ts +0 -41
- package/node_modules/@types/node/path/posix.d.ts +0 -8
- package/node_modules/@types/node/path/win32.d.ts +0 -8
- package/node_modules/@types/node/quic.d.ts +0 -910
- package/node_modules/@types/node/test/reporters.d.ts +0 -96
- package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +0 -71
- package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +0 -72
- package/node_modules/@types/node/ts5.7/index.d.ts +0 -117
- package/node_modules/@types/node/util/types.d.ts +0 -558
- package/node_modules/@types/node/web-globals/blob.d.ts +0 -23
- package/node_modules/@types/node/web-globals/console.d.ts +0 -9
- package/node_modules/@types/node/web-globals/crypto.d.ts +0 -39
- package/node_modules/@types/node/web-globals/encoding.d.ts +0 -11
- package/node_modules/@types/node/web-globals/importmeta.d.ts +0 -13
- package/node_modules/@types/node/web-globals/messaging.d.ts +0 -23
- package/node_modules/@types/node/web-globals/performance.d.ts +0 -45
- package/node_modules/@types/node/web-globals/streams.d.ts +0 -115
- package/node_modules/@types/node/web-globals/timers.d.ts +0 -44
- package/node_modules/@types/node/web-globals/url.d.ts +0 -24
- package/node_modules/undici-types/cache-interceptor.d.ts +0 -173
- package/node_modules/undici-types/client-stats.d.ts +0 -15
- package/node_modules/undici-types/h2c-client.d.ts +0 -73
- package/node_modules/undici-types/mock-call-history.d.ts +0 -111
- package/node_modules/undici-types/round-robin-pool.d.ts +0 -41
- package/node_modules/undici-types/snapshot-agent.d.ts +0 -109
- package/node_modules/undici-types/utility.d.ts +0 -7
|
@@ -76,12 +76,11 @@
|
|
|
76
76
|
*
|
|
77
77
|
* If any tests fail, the process exit code is set to `1`.
|
|
78
78
|
* @since v18.0.0, v16.17.0
|
|
79
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
79
|
+
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/test.js)
|
|
80
80
|
*/
|
|
81
81
|
declare module "node:test" {
|
|
82
82
|
import { AssertMethodNames } from "node:assert";
|
|
83
|
-
import { Readable
|
|
84
|
-
import { TestEvent } from "node:test/reporters";
|
|
83
|
+
import { Readable } from "node:stream";
|
|
85
84
|
import { URL } from "node:url";
|
|
86
85
|
import TestFn = test.TestFn;
|
|
87
86
|
import TestOptions = test.TestOptions;
|
|
@@ -191,11 +190,6 @@ declare module "node:test" {
|
|
|
191
190
|
function only(name?: string, fn?: SuiteFn): Promise<void>;
|
|
192
191
|
function only(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
193
192
|
function only(fn?: SuiteFn): Promise<void>;
|
|
194
|
-
// added in v25.5.0, undocumented
|
|
195
|
-
function expectFailure(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
196
|
-
function expectFailure(name?: string, fn?: SuiteFn): Promise<void>;
|
|
197
|
-
function expectFailure(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
198
|
-
function expectFailure(fn?: SuiteFn): Promise<void>;
|
|
199
193
|
}
|
|
200
194
|
/**
|
|
201
195
|
* Shorthand for skipping a test. This is the same as calling {@link test} with `options.skip` set to `true`.
|
|
@@ -221,11 +215,6 @@ declare module "node:test" {
|
|
|
221
215
|
function only(name?: string, fn?: TestFn): Promise<void>;
|
|
222
216
|
function only(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
223
217
|
function only(fn?: TestFn): Promise<void>;
|
|
224
|
-
// added in v25.5.0, undocumented
|
|
225
|
-
function expectFailure(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
226
|
-
function expectFailure(name?: string, fn?: TestFn): Promise<void>;
|
|
227
|
-
function expectFailure(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
228
|
-
function expectFailure(fn?: TestFn): Promise<void>;
|
|
229
218
|
/**
|
|
230
219
|
* The type of a function passed to {@link test}. The first argument to this function is a {@link TestContext} object.
|
|
231
220
|
* If the test uses callbacks, the callback function is passed as the second argument.
|
|
@@ -247,22 +236,14 @@ declare module "node:test" {
|
|
|
247
236
|
}
|
|
248
237
|
interface RunOptions {
|
|
249
238
|
/**
|
|
250
|
-
* If a number is provided, then that many
|
|
239
|
+
* If a number is provided, then that many test processes would run in parallel, where each process corresponds to one test file.
|
|
251
240
|
* If `true`, it would run `os.availableParallelism() - 1` test files in parallel. If `false`, it would only run one test file at a time.
|
|
252
241
|
* @default false
|
|
253
242
|
*/
|
|
254
243
|
concurrency?: number | boolean | undefined;
|
|
255
|
-
/**
|
|
256
|
-
* Specifies the current working directory to be used by the test runner.
|
|
257
|
-
* Serves as the base path for resolving files according to the
|
|
258
|
-
* [test runner execution model](https://nodejs.org/docs/latest-v25.x/api/test.html#test-runner-execution-model).
|
|
259
|
-
* @since v23.0.0
|
|
260
|
-
* @default process.cwd()
|
|
261
|
-
*/
|
|
262
|
-
cwd?: string | undefined;
|
|
263
244
|
/**
|
|
264
245
|
* An array containing the list of files to run. If omitted, files are run according to the
|
|
265
|
-
* [test runner execution model](https://nodejs.org/docs/latest-
|
|
246
|
+
* [test runner execution model](https://nodejs.org/docs/latest-v22.x/api/test.html#test-runner-execution-model).
|
|
266
247
|
*/
|
|
267
248
|
files?: readonly string[] | undefined;
|
|
268
249
|
/**
|
|
@@ -275,7 +256,7 @@ declare module "node:test" {
|
|
|
275
256
|
/**
|
|
276
257
|
* An array containing the list of glob patterns to match test files.
|
|
277
258
|
* This option cannot be used together with `files`. If omitted, files are run according to the
|
|
278
|
-
* [test runner execution model](https://nodejs.org/docs/latest-
|
|
259
|
+
* [test runner execution model](https://nodejs.org/docs/latest-v22.x/api/test.html#test-runner-execution-model).
|
|
279
260
|
* @since v22.6.0
|
|
280
261
|
*/
|
|
281
262
|
globPatterns?: readonly string[] | undefined;
|
|
@@ -356,14 +337,7 @@ declare module "node:test" {
|
|
|
356
337
|
*/
|
|
357
338
|
shard?: TestShard | undefined;
|
|
358
339
|
/**
|
|
359
|
-
*
|
|
360
|
-
* store the state of the tests to allow rerunning only the failed tests on a next run.
|
|
361
|
-
* @since v24.7.0
|
|
362
|
-
* @default undefined
|
|
363
|
-
*/
|
|
364
|
-
rerunFailuresFilePath?: string | undefined;
|
|
365
|
-
/**
|
|
366
|
-
* enable [code coverage](https://nodejs.org/docs/latest-v25.x/api/test.html#collecting-code-coverage) collection.
|
|
340
|
+
* enable [code coverage](https://nodejs.org/docs/latest-v22.x/api/test.html#collecting-code-coverage) collection.
|
|
367
341
|
* @since v22.10.0
|
|
368
342
|
* @default false
|
|
369
343
|
*/
|
|
@@ -410,23 +384,6 @@ declare module "node:test" {
|
|
|
410
384
|
*/
|
|
411
385
|
functionCoverage?: number | undefined;
|
|
412
386
|
}
|
|
413
|
-
interface TestsStreamEventMap extends ReadableEventMap {
|
|
414
|
-
"data": [data: TestEvent];
|
|
415
|
-
"test:coverage": [data: EventData.TestCoverage];
|
|
416
|
-
"test:complete": [data: EventData.TestComplete];
|
|
417
|
-
"test:dequeue": [data: EventData.TestDequeue];
|
|
418
|
-
"test:diagnostic": [data: EventData.TestDiagnostic];
|
|
419
|
-
"test:enqueue": [data: EventData.TestEnqueue];
|
|
420
|
-
"test:fail": [data: EventData.TestFail];
|
|
421
|
-
"test:pass": [data: EventData.TestPass];
|
|
422
|
-
"test:plan": [data: EventData.TestPlan];
|
|
423
|
-
"test:start": [data: EventData.TestStart];
|
|
424
|
-
"test:stderr": [data: EventData.TestStderr];
|
|
425
|
-
"test:stdout": [data: EventData.TestStdout];
|
|
426
|
-
"test:summary": [data: EventData.TestSummary];
|
|
427
|
-
"test:watch:drained": [];
|
|
428
|
-
"test:watch:restarted": [];
|
|
429
|
-
}
|
|
430
387
|
/**
|
|
431
388
|
* A successful call to `run()` will return a new `TestsStream` object, streaming a series of events representing the execution of the tests.
|
|
432
389
|
*
|
|
@@ -434,63 +391,94 @@ declare module "node:test" {
|
|
|
434
391
|
* @since v18.9.0, v16.19.0
|
|
435
392
|
*/
|
|
436
393
|
interface TestsStream extends Readable {
|
|
437
|
-
|
|
438
|
-
addListener
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
): this;
|
|
442
|
-
addListener(
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
):
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
):
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
):
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
): this;
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
): this;
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
): this;
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
): this;
|
|
488
|
-
|
|
489
|
-
|
|
394
|
+
addListener(event: "test:coverage", listener: (data: EventData.TestCoverage) => void): this;
|
|
395
|
+
addListener(event: "test:complete", listener: (data: EventData.TestComplete) => void): this;
|
|
396
|
+
addListener(event: "test:dequeue", listener: (data: EventData.TestDequeue) => void): this;
|
|
397
|
+
addListener(event: "test:diagnostic", listener: (data: EventData.TestDiagnostic) => void): this;
|
|
398
|
+
addListener(event: "test:enqueue", listener: (data: EventData.TestEnqueue) => void): this;
|
|
399
|
+
addListener(event: "test:fail", listener: (data: EventData.TestFail) => void): this;
|
|
400
|
+
addListener(event: "test:pass", listener: (data: EventData.TestPass) => void): this;
|
|
401
|
+
addListener(event: "test:plan", listener: (data: EventData.TestPlan) => void): this;
|
|
402
|
+
addListener(event: "test:start", listener: (data: EventData.TestStart) => void): this;
|
|
403
|
+
addListener(event: "test:stderr", listener: (data: EventData.TestStderr) => void): this;
|
|
404
|
+
addListener(event: "test:stdout", listener: (data: EventData.TestStdout) => void): this;
|
|
405
|
+
addListener(event: "test:summary", listener: (data: EventData.TestSummary) => void): this;
|
|
406
|
+
addListener(event: "test:watch:drained", listener: () => void): this;
|
|
407
|
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
408
|
+
emit(event: "test:coverage", data: EventData.TestCoverage): boolean;
|
|
409
|
+
emit(event: "test:complete", data: EventData.TestComplete): boolean;
|
|
410
|
+
emit(event: "test:dequeue", data: EventData.TestDequeue): boolean;
|
|
411
|
+
emit(event: "test:diagnostic", data: EventData.TestDiagnostic): boolean;
|
|
412
|
+
emit(event: "test:enqueue", data: EventData.TestEnqueue): boolean;
|
|
413
|
+
emit(event: "test:fail", data: EventData.TestFail): boolean;
|
|
414
|
+
emit(event: "test:pass", data: EventData.TestPass): boolean;
|
|
415
|
+
emit(event: "test:plan", data: EventData.TestPlan): boolean;
|
|
416
|
+
emit(event: "test:start", data: EventData.TestStart): boolean;
|
|
417
|
+
emit(event: "test:stderr", data: EventData.TestStderr): boolean;
|
|
418
|
+
emit(event: "test:stdout", data: EventData.TestStdout): boolean;
|
|
419
|
+
emit(event: "test:summary", data: EventData.TestSummary): boolean;
|
|
420
|
+
emit(event: "test:watch:drained"): boolean;
|
|
421
|
+
emit(event: string | symbol, ...args: any[]): boolean;
|
|
422
|
+
on(event: "test:coverage", listener: (data: EventData.TestCoverage) => void): this;
|
|
423
|
+
on(event: "test:complete", listener: (data: EventData.TestComplete) => void): this;
|
|
424
|
+
on(event: "test:dequeue", listener: (data: EventData.TestDequeue) => void): this;
|
|
425
|
+
on(event: "test:diagnostic", listener: (data: EventData.TestDiagnostic) => void): this;
|
|
426
|
+
on(event: "test:enqueue", listener: (data: EventData.TestEnqueue) => void): this;
|
|
427
|
+
on(event: "test:fail", listener: (data: EventData.TestFail) => void): this;
|
|
428
|
+
on(event: "test:pass", listener: (data: EventData.TestPass) => void): this;
|
|
429
|
+
on(event: "test:plan", listener: (data: EventData.TestPlan) => void): this;
|
|
430
|
+
on(event: "test:start", listener: (data: EventData.TestStart) => void): this;
|
|
431
|
+
on(event: "test:stderr", listener: (data: EventData.TestStderr) => void): this;
|
|
432
|
+
on(event: "test:stdout", listener: (data: EventData.TestStdout) => void): this;
|
|
433
|
+
on(event: "test:summary", listener: (data: EventData.TestSummary) => void): this;
|
|
434
|
+
on(event: "test:watch:drained", listener: () => void): this;
|
|
435
|
+
on(event: string, listener: (...args: any[]) => void): this;
|
|
436
|
+
once(event: "test:coverage", listener: (data: EventData.TestCoverage) => void): this;
|
|
437
|
+
once(event: "test:complete", listener: (data: EventData.TestComplete) => void): this;
|
|
438
|
+
once(event: "test:dequeue", listener: (data: EventData.TestDequeue) => void): this;
|
|
439
|
+
once(event: "test:diagnostic", listener: (data: EventData.TestDiagnostic) => void): this;
|
|
440
|
+
once(event: "test:enqueue", listener: (data: EventData.TestEnqueue) => void): this;
|
|
441
|
+
once(event: "test:fail", listener: (data: EventData.TestFail) => void): this;
|
|
442
|
+
once(event: "test:pass", listener: (data: EventData.TestPass) => void): this;
|
|
443
|
+
once(event: "test:plan", listener: (data: EventData.TestPlan) => void): this;
|
|
444
|
+
once(event: "test:start", listener: (data: EventData.TestStart) => void): this;
|
|
445
|
+
once(event: "test:stderr", listener: (data: EventData.TestStderr) => void): this;
|
|
446
|
+
once(event: "test:stdout", listener: (data: EventData.TestStdout) => void): this;
|
|
447
|
+
once(event: "test:summary", listener: (data: EventData.TestSummary) => void): this;
|
|
448
|
+
once(event: "test:watch:drained", listener: () => void): this;
|
|
449
|
+
once(event: string, listener: (...args: any[]) => void): this;
|
|
450
|
+
prependListener(event: "test:coverage", listener: (data: EventData.TestCoverage) => void): this;
|
|
451
|
+
prependListener(event: "test:complete", listener: (data: EventData.TestComplete) => void): this;
|
|
452
|
+
prependListener(event: "test:dequeue", listener: (data: EventData.TestDequeue) => void): this;
|
|
453
|
+
prependListener(event: "test:diagnostic", listener: (data: EventData.TestDiagnostic) => void): this;
|
|
454
|
+
prependListener(event: "test:enqueue", listener: (data: EventData.TestEnqueue) => void): this;
|
|
455
|
+
prependListener(event: "test:fail", listener: (data: EventData.TestFail) => void): this;
|
|
456
|
+
prependListener(event: "test:pass", listener: (data: EventData.TestPass) => void): this;
|
|
457
|
+
prependListener(event: "test:plan", listener: (data: EventData.TestPlan) => void): this;
|
|
458
|
+
prependListener(event: "test:start", listener: (data: EventData.TestStart) => void): this;
|
|
459
|
+
prependListener(event: "test:stderr", listener: (data: EventData.TestStderr) => void): this;
|
|
460
|
+
prependListener(event: "test:stdout", listener: (data: EventData.TestStdout) => void): this;
|
|
461
|
+
prependListener(event: "test:summary", listener: (data: EventData.TestSummary) => void): this;
|
|
462
|
+
prependListener(event: "test:watch:drained", listener: () => void): this;
|
|
463
|
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
464
|
+
prependOnceListener(event: "test:coverage", listener: (data: EventData.TestCoverage) => void): this;
|
|
465
|
+
prependOnceListener(event: "test:complete", listener: (data: EventData.TestComplete) => void): this;
|
|
466
|
+
prependOnceListener(event: "test:dequeue", listener: (data: EventData.TestDequeue) => void): this;
|
|
467
|
+
prependOnceListener(event: "test:diagnostic", listener: (data: EventData.TestDiagnostic) => void): this;
|
|
468
|
+
prependOnceListener(event: "test:enqueue", listener: (data: EventData.TestEnqueue) => void): this;
|
|
469
|
+
prependOnceListener(event: "test:fail", listener: (data: EventData.TestFail) => void): this;
|
|
470
|
+
prependOnceListener(event: "test:pass", listener: (data: EventData.TestPass) => void): this;
|
|
471
|
+
prependOnceListener(event: "test:plan", listener: (data: EventData.TestPlan) => void): this;
|
|
472
|
+
prependOnceListener(event: "test:start", listener: (data: EventData.TestStart) => void): this;
|
|
473
|
+
prependOnceListener(event: "test:stderr", listener: (data: EventData.TestStderr) => void): this;
|
|
474
|
+
prependOnceListener(event: "test:stdout", listener: (data: EventData.TestStdout) => void): this;
|
|
475
|
+
prependOnceListener(event: "test:summary", listener: (data: EventData.TestSummary) => void): this;
|
|
476
|
+
prependOnceListener(event: "test:watch:drained", listener: () => void): this;
|
|
477
|
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
490
478
|
}
|
|
491
479
|
namespace EventData {
|
|
492
480
|
interface Error extends globalThis.Error {
|
|
493
|
-
cause:
|
|
481
|
+
cause: globalThis.Error;
|
|
494
482
|
}
|
|
495
483
|
interface LocationInfo {
|
|
496
484
|
/**
|
|
@@ -710,7 +698,7 @@ declare module "node:test" {
|
|
|
710
698
|
/**
|
|
711
699
|
* The type of the test, used to denote whether this is a suite.
|
|
712
700
|
*/
|
|
713
|
-
type?: "suite"
|
|
701
|
+
type?: "suite";
|
|
714
702
|
};
|
|
715
703
|
/**
|
|
716
704
|
* The test name.
|
|
@@ -780,13 +768,7 @@ declare module "node:test" {
|
|
|
780
768
|
* The type of the test, used to denote whether this is a suite.
|
|
781
769
|
* @since v20.0.0, v19.9.0, v18.17.0
|
|
782
770
|
*/
|
|
783
|
-
type?: "suite"
|
|
784
|
-
/**
|
|
785
|
-
* The attempt number of the test run,
|
|
786
|
-
* present only when using the `--test-rerun-failures` flag.
|
|
787
|
-
* @since v24.7.0
|
|
788
|
-
*/
|
|
789
|
-
attempt?: number;
|
|
771
|
+
type?: "suite";
|
|
790
772
|
};
|
|
791
773
|
/**
|
|
792
774
|
* The test name.
|
|
@@ -822,19 +804,7 @@ declare module "node:test" {
|
|
|
822
804
|
* The type of the test, used to denote whether this is a suite.
|
|
823
805
|
* @since 20.0.0, 19.9.0, 18.17.0
|
|
824
806
|
*/
|
|
825
|
-
type?: "suite"
|
|
826
|
-
/**
|
|
827
|
-
* The attempt number of the test run,
|
|
828
|
-
* present only when using the `--test-rerun-failures` flag.
|
|
829
|
-
* @since v24.7.0
|
|
830
|
-
*/
|
|
831
|
-
attempt?: number;
|
|
832
|
-
/**
|
|
833
|
-
* The attempt number the test passed on,
|
|
834
|
-
* present only when using the `--test-rerun-failures` flag.
|
|
835
|
-
* @since v24.7.0
|
|
836
|
-
*/
|
|
837
|
-
passed_on_attempt?: number;
|
|
807
|
+
type?: "suite";
|
|
838
808
|
};
|
|
839
809
|
/**
|
|
840
810
|
* The test name.
|
|
@@ -1041,21 +1011,6 @@ declare module "node:test" {
|
|
|
1041
1011
|
* @since v18.8.0, v16.18.0
|
|
1042
1012
|
*/
|
|
1043
1013
|
readonly name: string;
|
|
1044
|
-
/**
|
|
1045
|
-
* Indicated whether the test succeeded.
|
|
1046
|
-
* @since v21.7.0, v20.12.0
|
|
1047
|
-
*/
|
|
1048
|
-
readonly passed: boolean;
|
|
1049
|
-
/**
|
|
1050
|
-
* The failure reason for the test/case; wrapped and available via `context.error.cause`.
|
|
1051
|
-
* @since v21.7.0, v20.12.0
|
|
1052
|
-
*/
|
|
1053
|
-
readonly error: EventData.Error | null;
|
|
1054
|
-
/**
|
|
1055
|
-
* Number of times the test has been attempted.
|
|
1056
|
-
* @since v21.7.0, v20.12.0
|
|
1057
|
-
*/
|
|
1058
|
-
readonly attempt: number;
|
|
1059
1014
|
/**
|
|
1060
1015
|
* This function is used to set the number of assertions and subtests that are expected to run
|
|
1061
1016
|
* within the test. If the number of assertions and subtests that run does not match the
|
|
@@ -1224,7 +1179,7 @@ declare module "node:test" {
|
|
|
1224
1179
|
* highlighting.
|
|
1225
1180
|
* @since v22.14.0
|
|
1226
1181
|
* @param value A value to serialize to a string. If Node.js was started with
|
|
1227
|
-
* the [`--test-update-snapshots`](https://nodejs.org/docs/latest-
|
|
1182
|
+
* the [`--test-update-snapshots`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--test-update-snapshots)
|
|
1228
1183
|
* flag, the serialized value is written to
|
|
1229
1184
|
* `path`. Otherwise, the serialized value is compared to the contents of the
|
|
1230
1185
|
* existing snapshot file.
|
|
@@ -1247,7 +1202,7 @@ declare module "node:test" {
|
|
|
1247
1202
|
* ```
|
|
1248
1203
|
* @since v22.3.0
|
|
1249
1204
|
* @param value A value to serialize to a string. If Node.js was started with
|
|
1250
|
-
* the [`--test-update-snapshots`](https://nodejs.org/docs/latest-
|
|
1205
|
+
* the [`--test-update-snapshots`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--test-update-snapshots)
|
|
1251
1206
|
* flag, the serialized value is written to
|
|
1252
1207
|
* the snapshot file. Otherwise, the serialized value is compared to the
|
|
1253
1208
|
* corresponding value in the existing snapshot file.
|
|
@@ -1310,11 +1265,6 @@ declare module "node:test" {
|
|
|
1310
1265
|
* @since v22.6.0
|
|
1311
1266
|
*/
|
|
1312
1267
|
readonly filePath: string | undefined;
|
|
1313
|
-
/**
|
|
1314
|
-
* The name of the suite and each of its ancestors, separated by `>`.
|
|
1315
|
-
* @since v22.3.0, v20.16.0
|
|
1316
|
-
*/
|
|
1317
|
-
readonly fullName: string;
|
|
1318
1268
|
/**
|
|
1319
1269
|
* The name of the suite.
|
|
1320
1270
|
* @since v18.8.0, v16.18.0
|
|
@@ -1374,8 +1324,6 @@ declare module "node:test" {
|
|
|
1374
1324
|
* @since v22.2.0
|
|
1375
1325
|
*/
|
|
1376
1326
|
plan?: number | undefined;
|
|
1377
|
-
// added in v25.5.0, undocumented
|
|
1378
|
-
expectFailure?: boolean | undefined;
|
|
1379
1327
|
}
|
|
1380
1328
|
/**
|
|
1381
1329
|
* This function creates a hook that runs before executing a suite.
|
|
@@ -1384,7 +1332,7 @@ declare module "node:test" {
|
|
|
1384
1332
|
* describe('tests', async () => {
|
|
1385
1333
|
* before(() => console.log('about to run some test'));
|
|
1386
1334
|
* it('is a subtest', () => {
|
|
1387
|
-
*
|
|
1335
|
+
* assert.ok('some relevant assertion here');
|
|
1388
1336
|
* });
|
|
1389
1337
|
* });
|
|
1390
1338
|
* ```
|
|
@@ -1400,7 +1348,7 @@ declare module "node:test" {
|
|
|
1400
1348
|
* describe('tests', async () => {
|
|
1401
1349
|
* after(() => console.log('finished running tests'));
|
|
1402
1350
|
* it('is a subtest', () => {
|
|
1403
|
-
*
|
|
1351
|
+
* assert.ok('some relevant assertion here');
|
|
1404
1352
|
* });
|
|
1405
1353
|
* });
|
|
1406
1354
|
* ```
|
|
@@ -1416,7 +1364,7 @@ declare module "node:test" {
|
|
|
1416
1364
|
* describe('tests', async () => {
|
|
1417
1365
|
* beforeEach(() => console.log('about to run a test'));
|
|
1418
1366
|
* it('is a subtest', () => {
|
|
1419
|
-
*
|
|
1367
|
+
* assert.ok('some relevant assertion here');
|
|
1420
1368
|
* });
|
|
1421
1369
|
* });
|
|
1422
1370
|
* ```
|
|
@@ -1433,7 +1381,7 @@ declare module "node:test" {
|
|
|
1433
1381
|
* describe('tests', async () => {
|
|
1434
1382
|
* afterEach(() => console.log('finished running a test'));
|
|
1435
1383
|
* it('is a subtest', () => {
|
|
1436
|
-
*
|
|
1384
|
+
* assert.ok('some relevant assertion here');
|
|
1437
1385
|
* });
|
|
1438
1386
|
* });
|
|
1439
1387
|
* ```
|
|
@@ -1682,89 +1630,16 @@ declare module "node:test" {
|
|
|
1682
1630
|
options?: MockFunctionOptions,
|
|
1683
1631
|
): Mock<((value: MockedObject[MethodName]) => void) | Implementation>;
|
|
1684
1632
|
/**
|
|
1685
|
-
* This function is used to mock the exports of ECMAScript modules, CommonJS modules,
|
|
1686
|
-
*
|
|
1687
|
-
* order to enable module mocking, Node.js must be started with the
|
|
1688
|
-
* [`--experimental-test-module-mocks`](https://nodejs.org/docs/latest-v25.x/api/cli.html#--experimental-test-module-mocks)
|
|
1689
|
-
* command-line flag.
|
|
1690
|
-
*
|
|
1691
|
-
* The following example demonstrates how a mock is created for a module.
|
|
1692
|
-
*
|
|
1693
|
-
* ```js
|
|
1694
|
-
* test('mocks a builtin module in both module systems', async (t) => {
|
|
1695
|
-
* // Create a mock of 'node:readline' with a named export named 'fn', which
|
|
1696
|
-
* // does not exist in the original 'node:readline' module.
|
|
1697
|
-
* const mock = t.mock.module('node:readline', {
|
|
1698
|
-
* namedExports: { fn() { return 42; } },
|
|
1699
|
-
* });
|
|
1633
|
+
* This function is used to mock the exports of ECMAScript modules, CommonJS modules, and Node.js builtin modules.
|
|
1634
|
+
* Any references to the original module prior to mocking are not impacted.
|
|
1700
1635
|
*
|
|
1701
|
-
*
|
|
1702
|
-
* let cjsImpl = require('node:readline');
|
|
1703
|
-
*
|
|
1704
|
-
* // cursorTo() is an export of the original 'node:readline' module.
|
|
1705
|
-
* assert.strictEqual(esmImpl.cursorTo, undefined);
|
|
1706
|
-
* assert.strictEqual(cjsImpl.cursorTo, undefined);
|
|
1707
|
-
* assert.strictEqual(esmImpl.fn(), 42);
|
|
1708
|
-
* assert.strictEqual(cjsImpl.fn(), 42);
|
|
1709
|
-
*
|
|
1710
|
-
* mock.restore();
|
|
1711
|
-
*
|
|
1712
|
-
* // The mock is restored, so the original builtin module is returned.
|
|
1713
|
-
* esmImpl = await import('node:readline');
|
|
1714
|
-
* cjsImpl = require('node:readline');
|
|
1715
|
-
*
|
|
1716
|
-
* assert.strictEqual(typeof esmImpl.cursorTo, 'function');
|
|
1717
|
-
* assert.strictEqual(typeof cjsImpl.cursorTo, 'function');
|
|
1718
|
-
* assert.strictEqual(esmImpl.fn, undefined);
|
|
1719
|
-
* assert.strictEqual(cjsImpl.fn, undefined);
|
|
1720
|
-
* });
|
|
1721
|
-
* ```
|
|
1636
|
+
* Only available through the [--experimental-test-module-mocks](https://nodejs.org/api/cli.html#--experimental-test-module-mocks) flag.
|
|
1722
1637
|
* @since v22.3.0
|
|
1723
1638
|
* @experimental
|
|
1724
1639
|
* @param specifier A string identifying the module to mock.
|
|
1725
1640
|
* @param options Optional configuration options for the mock module.
|
|
1726
1641
|
*/
|
|
1727
1642
|
module(specifier: string | URL, options?: MockModuleOptions): MockModuleContext;
|
|
1728
|
-
/**
|
|
1729
|
-
* Creates a mock for a property value on an object. This allows you to track and control access to a specific property,
|
|
1730
|
-
* including how many times it is read (getter) or written (setter), and to restore the original value after mocking.
|
|
1731
|
-
*
|
|
1732
|
-
* ```js
|
|
1733
|
-
* test('mocks a property value', (t) => {
|
|
1734
|
-
* const obj = { foo: 42 };
|
|
1735
|
-
* const prop = t.mock.property(obj, 'foo', 100);
|
|
1736
|
-
*
|
|
1737
|
-
* assert.strictEqual(obj.foo, 100);
|
|
1738
|
-
* assert.strictEqual(prop.mock.accessCount(), 1);
|
|
1739
|
-
* assert.strictEqual(prop.mock.accesses[0].type, 'get');
|
|
1740
|
-
* assert.strictEqual(prop.mock.accesses[0].value, 100);
|
|
1741
|
-
*
|
|
1742
|
-
* obj.foo = 200;
|
|
1743
|
-
* assert.strictEqual(prop.mock.accessCount(), 2);
|
|
1744
|
-
* assert.strictEqual(prop.mock.accesses[1].type, 'set');
|
|
1745
|
-
* assert.strictEqual(prop.mock.accesses[1].value, 200);
|
|
1746
|
-
*
|
|
1747
|
-
* prop.mock.restore();
|
|
1748
|
-
* assert.strictEqual(obj.foo, 42);
|
|
1749
|
-
* });
|
|
1750
|
-
* ```
|
|
1751
|
-
* @since v24.3.0
|
|
1752
|
-
* @param object The object whose value is being mocked.
|
|
1753
|
-
* @param propertyName The identifier of the property on `object` to mock.
|
|
1754
|
-
* @param value An optional value used as the mock value
|
|
1755
|
-
* for `object[propertyName]`. **Default:** The original property value.
|
|
1756
|
-
* @returns A proxy to the mocked object. The mocked object contains a
|
|
1757
|
-
* special `mock` property, which is an instance of [`MockPropertyContext`][], and
|
|
1758
|
-
* can be used for inspecting and changing the behavior of the mocked property.
|
|
1759
|
-
*/
|
|
1760
|
-
property<
|
|
1761
|
-
MockedObject extends object,
|
|
1762
|
-
PropertyName extends keyof MockedObject,
|
|
1763
|
-
>(
|
|
1764
|
-
object: MockedObject,
|
|
1765
|
-
property: PropertyName,
|
|
1766
|
-
value?: MockedObject[PropertyName],
|
|
1767
|
-
): MockedObject & { mock: MockPropertyContext<MockedObject[PropertyName]> };
|
|
1768
1643
|
/**
|
|
1769
1644
|
* This function restores the default behavior of all mocks that were previously
|
|
1770
1645
|
* created by this `MockTracker` and disassociates the mocks from the `MockTracker` instance. Once disassociated, the mocks can still be used, but the `MockTracker` instance can no longer be
|
|
@@ -1934,70 +1809,6 @@ declare module "node:test" {
|
|
|
1934
1809
|
*/
|
|
1935
1810
|
restore(): void;
|
|
1936
1811
|
}
|
|
1937
|
-
/**
|
|
1938
|
-
* @since v24.3.0
|
|
1939
|
-
*/
|
|
1940
|
-
class MockPropertyContext<PropertyType = any> {
|
|
1941
|
-
/**
|
|
1942
|
-
* A getter that returns a copy of the internal array used to track accesses (get/set) to
|
|
1943
|
-
* the mocked property. Each entry in the array is an object with the following properties:
|
|
1944
|
-
*/
|
|
1945
|
-
readonly accesses: Array<{
|
|
1946
|
-
type: "get" | "set";
|
|
1947
|
-
value: PropertyType;
|
|
1948
|
-
stack: Error;
|
|
1949
|
-
}>;
|
|
1950
|
-
/**
|
|
1951
|
-
* This function returns the number of times that the property was accessed.
|
|
1952
|
-
* This function is more efficient than checking `ctx.accesses.length` because
|
|
1953
|
-
* `ctx.accesses` is a getter that creates a copy of the internal access tracking array.
|
|
1954
|
-
* @returns The number of times that the property was accessed (read or written).
|
|
1955
|
-
*/
|
|
1956
|
-
accessCount(): number;
|
|
1957
|
-
/**
|
|
1958
|
-
* This function is used to change the value returned by the mocked property getter.
|
|
1959
|
-
* @param value The new value to be set as the mocked property value.
|
|
1960
|
-
*/
|
|
1961
|
-
mockImplementation(value: PropertyType): void;
|
|
1962
|
-
/**
|
|
1963
|
-
* This function is used to change the behavior of an existing mock for a single
|
|
1964
|
-
* invocation. Once invocation `onAccess` has occurred, the mock will revert to
|
|
1965
|
-
* whatever behavior it would have used had `mockImplementationOnce()` not been
|
|
1966
|
-
* called.
|
|
1967
|
-
*
|
|
1968
|
-
* The following example creates a mock function using `t.mock.property()`, calls the
|
|
1969
|
-
* mock property, changes the mock implementation to a different value for the
|
|
1970
|
-
* next invocation, and then resumes its previous behavior.
|
|
1971
|
-
*
|
|
1972
|
-
* ```js
|
|
1973
|
-
* test('changes a mock behavior once', (t) => {
|
|
1974
|
-
* const obj = { foo: 1 };
|
|
1975
|
-
*
|
|
1976
|
-
* const prop = t.mock.property(obj, 'foo', 5);
|
|
1977
|
-
*
|
|
1978
|
-
* assert.strictEqual(obj.foo, 5);
|
|
1979
|
-
* prop.mock.mockImplementationOnce(25);
|
|
1980
|
-
* assert.strictEqual(obj.foo, 25);
|
|
1981
|
-
* assert.strictEqual(obj.foo, 5);
|
|
1982
|
-
* });
|
|
1983
|
-
* ```
|
|
1984
|
-
* @param value The value to be used as the mock's
|
|
1985
|
-
* implementation for the invocation number specified by `onAccess`.
|
|
1986
|
-
* @param onAccess The invocation number that will use `value`. If
|
|
1987
|
-
* the specified invocation has already occurred then an exception is thrown.
|
|
1988
|
-
* **Default:** The number of the next invocation.
|
|
1989
|
-
*/
|
|
1990
|
-
mockImplementationOnce(value: PropertyType, onAccess?: number): void;
|
|
1991
|
-
/**
|
|
1992
|
-
* Resets the access history of the mocked property.
|
|
1993
|
-
*/
|
|
1994
|
-
resetAccesses(): void;
|
|
1995
|
-
/**
|
|
1996
|
-
* Resets the implementation of the mock property to its original behavior. The
|
|
1997
|
-
* mock can still be used after calling this function.
|
|
1998
|
-
*/
|
|
1999
|
-
restore(): void;
|
|
2000
|
-
}
|
|
2001
1812
|
interface MockTimersOptions {
|
|
2002
1813
|
apis: ReadonlyArray<"setInterval" | "setTimeout" | "setImmediate" | "Date">;
|
|
2003
1814
|
now?: number | Date | undefined;
|
|
@@ -2013,6 +1824,7 @@ declare module "node:test" {
|
|
|
2013
1824
|
* The `MockTracker` provides a top-level `timers` export
|
|
2014
1825
|
* which is a `MockTimers` instance.
|
|
2015
1826
|
* @since v20.4.0
|
|
1827
|
+
* @experimental
|
|
2016
1828
|
*/
|
|
2017
1829
|
interface MockTimers {
|
|
2018
1830
|
/**
|
|
@@ -2065,28 +1877,24 @@ declare module "node:test" {
|
|
|
2065
1877
|
*/
|
|
2066
1878
|
enable(options?: MockTimersOptions): void;
|
|
2067
1879
|
/**
|
|
2068
|
-
*
|
|
2069
|
-
*
|
|
2070
|
-
*
|
|
1880
|
+
* You can use the `.setTime()` method to manually move the mocked date to another time. This method only accepts a positive integer.
|
|
1881
|
+
* Note: This method will execute any mocked timers that are in the past from the new time.
|
|
1882
|
+
* In the below example we are setting a new time for the mocked date.
|
|
2071
1883
|
* ```js
|
|
2072
1884
|
* import assert from 'node:assert';
|
|
2073
1885
|
* import { test } from 'node:test';
|
|
2074
|
-
*
|
|
2075
|
-
*
|
|
2076
|
-
*
|
|
2077
|
-
*
|
|
2078
|
-
* //
|
|
2079
|
-
*
|
|
2080
|
-
*
|
|
2081
|
-
*
|
|
2082
|
-
* context.mock.timers.setTime(setTime);
|
|
2083
|
-
* // Date.now is now 1000
|
|
2084
|
-
* assert.strictEqual(Date.now(), setTime);
|
|
1886
|
+
* test('sets the time of a date object', (context) => {
|
|
1887
|
+
* // Optionally choose what to mock
|
|
1888
|
+
* context.mock.timers.enable({ apis: ['Date'], now: 100 });
|
|
1889
|
+
* assert.strictEqual(Date.now(), 100);
|
|
1890
|
+
* // Advance in time will also advance the date
|
|
1891
|
+
* context.mock.timers.setTime(1000);
|
|
1892
|
+
* context.mock.timers.tick(200);
|
|
1893
|
+
* assert.strictEqual(Date.now(), 1200);
|
|
2085
1894
|
* });
|
|
2086
1895
|
* ```
|
|
2087
|
-
* @since v21.2.0, v20.11.0
|
|
2088
1896
|
*/
|
|
2089
|
-
setTime(
|
|
1897
|
+
setTime(time: number): void;
|
|
2090
1898
|
/**
|
|
2091
1899
|
* This function restores the default behavior of all mocks that were previously
|
|
2092
1900
|
* created by this `MockTimers` instance and disassociates the mocks
|
|
@@ -2273,3 +2081,83 @@ declare module "node:test" {
|
|
|
2273
2081
|
}[keyof T];
|
|
2274
2082
|
export = test;
|
|
2275
2083
|
}
|
|
2084
|
+
|
|
2085
|
+
/**
|
|
2086
|
+
* The `node:test/reporters` module exposes the builtin-reporters for `node:test`.
|
|
2087
|
+
* To access it:
|
|
2088
|
+
*
|
|
2089
|
+
* ```js
|
|
2090
|
+
* import test from 'node:test/reporters';
|
|
2091
|
+
* ```
|
|
2092
|
+
*
|
|
2093
|
+
* This module is only available under the `node:` scheme. The following will not
|
|
2094
|
+
* work:
|
|
2095
|
+
*
|
|
2096
|
+
* ```js
|
|
2097
|
+
* import test from 'node:test/reporters';
|
|
2098
|
+
* ```
|
|
2099
|
+
* @since v19.9.0
|
|
2100
|
+
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/test/reporters.js)
|
|
2101
|
+
*/
|
|
2102
|
+
declare module "node:test/reporters" {
|
|
2103
|
+
import { Transform, TransformOptions } from "node:stream";
|
|
2104
|
+
import { EventData } from "node:test";
|
|
2105
|
+
|
|
2106
|
+
type TestEvent =
|
|
2107
|
+
| { type: "test:coverage"; data: EventData.TestCoverage }
|
|
2108
|
+
| { type: "test:complete"; data: EventData.TestComplete }
|
|
2109
|
+
| { type: "test:dequeue"; data: EventData.TestDequeue }
|
|
2110
|
+
| { type: "test:diagnostic"; data: EventData.TestDiagnostic }
|
|
2111
|
+
| { type: "test:enqueue"; data: EventData.TestEnqueue }
|
|
2112
|
+
| { type: "test:fail"; data: EventData.TestFail }
|
|
2113
|
+
| { type: "test:pass"; data: EventData.TestPass }
|
|
2114
|
+
| { type: "test:plan"; data: EventData.TestPlan }
|
|
2115
|
+
| { type: "test:start"; data: EventData.TestStart }
|
|
2116
|
+
| { type: "test:stderr"; data: EventData.TestStderr }
|
|
2117
|
+
| { type: "test:stdout"; data: EventData.TestStdout }
|
|
2118
|
+
| { type: "test:summary"; data: EventData.TestSummary }
|
|
2119
|
+
| { type: "test:watch:drained"; data: undefined };
|
|
2120
|
+
type TestEventGenerator = AsyncGenerator<TestEvent, void>;
|
|
2121
|
+
|
|
2122
|
+
interface ReporterConstructorWrapper<T extends new(...args: any[]) => Transform> {
|
|
2123
|
+
new(...args: ConstructorParameters<T>): InstanceType<T>;
|
|
2124
|
+
(...args: ConstructorParameters<T>): InstanceType<T>;
|
|
2125
|
+
}
|
|
2126
|
+
|
|
2127
|
+
/**
|
|
2128
|
+
* The `dot` reporter outputs the test results in a compact format,
|
|
2129
|
+
* where each passing test is represented by a `.`,
|
|
2130
|
+
* and each failing test is represented by a `X`.
|
|
2131
|
+
* @since v20.0.0
|
|
2132
|
+
*/
|
|
2133
|
+
function dot(source: TestEventGenerator): AsyncGenerator<"\n" | "." | "X", void>;
|
|
2134
|
+
/**
|
|
2135
|
+
* The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format.
|
|
2136
|
+
* @since v20.0.0
|
|
2137
|
+
*/
|
|
2138
|
+
function tap(source: TestEventGenerator): AsyncGenerator<string, void>;
|
|
2139
|
+
class SpecReporter extends Transform {
|
|
2140
|
+
constructor();
|
|
2141
|
+
}
|
|
2142
|
+
/**
|
|
2143
|
+
* The `spec` reporter outputs the test results in a human-readable format.
|
|
2144
|
+
* @since v20.0.0
|
|
2145
|
+
*/
|
|
2146
|
+
const spec: ReporterConstructorWrapper<typeof SpecReporter>;
|
|
2147
|
+
/**
|
|
2148
|
+
* The `junit` reporter outputs test results in a jUnit XML format.
|
|
2149
|
+
* @since v21.0.0
|
|
2150
|
+
*/
|
|
2151
|
+
function junit(source: TestEventGenerator): AsyncGenerator<string, void>;
|
|
2152
|
+
class LcovReporter extends Transform {
|
|
2153
|
+
constructor(opts?: Omit<TransformOptions, "writableObjectMode">);
|
|
2154
|
+
}
|
|
2155
|
+
/**
|
|
2156
|
+
* The `lcov` reporter outputs test coverage when used with the
|
|
2157
|
+
* [`--experimental-test-coverage`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--experimental-test-coverage) flag.
|
|
2158
|
+
* @since v22.0.0
|
|
2159
|
+
*/
|
|
2160
|
+
const lcov: LcovReporter;
|
|
2161
|
+
|
|
2162
|
+
export { dot, junit, lcov, spec, tap, TestEvent };
|
|
2163
|
+
}
|