@idlebox/stripe-node-types 24.0.14-patch.0 → 24.0.15
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 -1
- package/assert/strict.d.ts +113 -1
- package/assert.d.ts +162 -248
- package/async_hooks.d.ts +20 -5
- package/buffer.buffer.d.ts +24 -6
- package/buffer.d.ts +63 -168
- package/child_process.d.ts +117 -223
- package/cluster.d.ts +251 -329
- package/compatibility/iterators.d.ts +15 -0
- package/console.d.ts +60 -346
- package/constants.d.ts +15 -1
- package/crypto.d.ts +713 -1149
- package/dgram.d.ts +30 -50
- package/diagnostics_channel.d.ts +16 -3
- package/dns/promises.d.ts +15 -0
- package/dns.d.ts +150 -131
- package/domain.d.ts +25 -14
- package/events.d.ts +858 -719
- package/fs/promises.d.ts +117 -53
- package/fs.d.ts +729 -484
- package/globals.d.ts +142 -344
- package/globals.typedarray.d.ts +94 -0
- package/http.d.ts +358 -246
- package/http2.d.ts +578 -711
- package/https.d.ts +85 -216
- package/index.d.ts +39 -3
- package/inspector/promises.d.ts +54 -0
- package/inspector.d.ts +180 -3936
- package/inspector.generated.d.ts +4242 -0
- package/module.d.ts +60 -95
- package/my-shim.d.ts +15 -0
- package/net.d.ts +102 -186
- package/os.d.ts +32 -6
- package/package.json +3 -8
- package/path/posix.d.ts +20 -0
- package/path/win32.d.ts +20 -0
- package/path.d.ts +132 -122
- package/perf_hooks.d.ts +310 -644
- package/process.d.ts +192 -138
- package/punycode.d.ts +17 -2
- package/querystring.d.ts +16 -1
- package/quic.d.ts +926 -0
- package/readline/promises.d.ts +16 -1
- package/readline.d.ts +80 -118
- package/repl.d.ts +98 -96
- package/sea.d.ts +25 -1
- package/sqlite.d.ts +277 -13
- package/stream/consumers.d.ts +22 -7
- package/stream/promises.d.ts +148 -12
- package/stream/web.d.ts +187 -494
- package/stream.d.ts +608 -490
- package/string_decoder.d.ts +18 -3
- package/test/reporters.d.ts +112 -0
- package/test.d.ts +238 -199
- package/timers/promises.d.ts +16 -1
- package/timers.d.ts +16 -129
- package/tls.d.ts +163 -163
- package/trace_events.d.ts +21 -6
- package/ts5.6/buffer.buffer.d.ts +25 -8
- package/ts5.6/compatibility/float16array.d.ts +15 -0
- package/ts5.6/globals.typedarray.d.ts +31 -0
- package/ts5.6/index.d.ts +39 -3
- package/ts5.7/compatibility/float16array.d.ts +15 -0
- package/ts5.7/index.d.ts +39 -3
- package/tty.d.ts +70 -13
- package/undici-types/agent.d.ts +20 -4
- package/undici-types/api.d.ts +15 -0
- package/undici-types/balanced-pool.d.ts +15 -0
- package/undici-types/cache-interceptor.d.ts +15 -0
- package/undici-types/cache.d.ts +15 -0
- package/undici-types/client-stats.d.ts +31 -0
- package/undici-types/client.d.ts +21 -5
- package/undici-types/connector.d.ts +15 -0
- package/undici-types/content-type.d.ts +15 -0
- package/undici-types/cookies.d.ts +15 -0
- package/undici-types/diagnostics-channel.d.ts +24 -1
- package/undici-types/dispatcher.d.ts +18 -8
- package/undici-types/env-http-proxy-agent.d.ts +17 -1
- package/undici-types/errors.d.ts +20 -15
- package/undici-types/eventsource.d.ts +24 -4
- package/undici-types/fetch.d.ts +16 -0
- package/undici-types/formdata.d.ts +15 -0
- package/undici-types/global-dispatcher.d.ts +15 -0
- package/undici-types/global-origin.d.ts +15 -0
- package/undici-types/h2c-client.d.ts +15 -2
- package/undici-types/handlers.d.ts +16 -1
- package/undici-types/header.d.ts +15 -0
- package/undici-types/index.d.ts +21 -1
- package/undici-types/interceptors.d.ts +20 -0
- package/undici-types/mock-agent.d.ts +18 -0
- package/undici-types/mock-call-history.d.ts +15 -0
- package/undici-types/mock-client.d.ts +17 -0
- package/undici-types/mock-errors.d.ts +15 -0
- package/undici-types/mock-interceptor.d.ts +17 -1
- package/undici-types/mock-pool.d.ts +17 -0
- package/undici-types/package.json +1 -1
- package/undici-types/patch.d.ts +15 -0
- package/undici-types/pool-stats.d.ts +15 -0
- package/undici-types/pool.d.ts +17 -0
- package/undici-types/proxy-agent.d.ts +16 -0
- package/undici-types/readable.d.ts +15 -0
- package/undici-types/retry-agent.d.ts +15 -0
- package/undici-types/retry-handler.d.ts +24 -0
- package/undici-types/snapshot-agent.d.ts +125 -0
- package/undici-types/util.d.ts +15 -0
- package/undici-types/utility.d.ts +15 -0
- package/undici-types/webidl.d.ts +126 -36
- package/undici-types/websocket.d.ts +18 -1
- package/url.d.ts +107 -587
- package/util/types.d.ts +571 -0
- package/util.d.ts +158 -792
- package/v8.d.ts +82 -7
- package/vm.d.ts +267 -108
- package/wasi.d.ts +38 -2
- package/web-globals/abortcontroller.d.ts +75 -0
- package/web-globals/blob.d.ts +39 -0
- package/web-globals/console.d.ts +25 -0
- package/web-globals/crypto.d.ts +55 -0
- package/web-globals/domexception.d.ts +84 -0
- package/web-globals/encoding.d.ts +27 -0
- package/{dom-events.d.ts → web-globals/events.d.ts} +72 -50
- package/web-globals/fetch.d.ts +70 -0
- package/web-globals/importmeta.d.ts +29 -0
- package/web-globals/messaging.d.ts +39 -0
- package/web-globals/navigator.d.ts +41 -0
- package/web-globals/performance.d.ts +61 -0
- package/web-globals/storage.d.ts +40 -0
- package/web-globals/streams.d.ts +131 -0
- package/web-globals/timers.d.ts +60 -0
- package/web-globals/url.d.ts +40 -0
- package/worker_threads.d.ts +306 -349
- package/zlib.d.ts +59 -94
- package/ts5.1/compatibility/disposable.d.ts +0 -13
- package/ts5.1/index.d.ts +0 -100
package/test.d.ts
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
// biome-ignore-all lint: generated file
|
|
2
|
+
// biome-ignore-all assist: generated file
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
|
|
6
|
+
/******************************************************************************
|
|
7
|
+
* GENERATED FILE, DO NOT MODIFY
|
|
8
|
+
* 这是生成的文件,千万不要修改
|
|
9
|
+
*
|
|
10
|
+
* @build-script/codegen - The Simple Code Generater
|
|
11
|
+
* https://github.com/GongT/baobao
|
|
12
|
+
*
|
|
13
|
+
******************************************************************************/
|
|
14
|
+
|
|
15
|
+
|
|
1
16
|
/**
|
|
2
17
|
* The `node:test` module facilitates the creation of JavaScript tests.
|
|
3
18
|
* To access it:
|
|
@@ -76,29 +91,13 @@
|
|
|
76
91
|
*
|
|
77
92
|
* If any tests fail, the process exit code is set to `1`.
|
|
78
93
|
* @since v18.0.0, v16.17.0
|
|
79
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
80
|
-
*/
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* The `node:test/reporters` module exposes the builtin-reporters for `node:test`.
|
|
84
|
-
* To access it:
|
|
85
|
-
*
|
|
86
|
-
* ```js
|
|
87
|
-
* import test from 'node:test/reporters';
|
|
88
|
-
* ```
|
|
89
|
-
*
|
|
90
|
-
* This module is only available under the `node:` scheme. The following will not
|
|
91
|
-
* work:
|
|
92
|
-
*
|
|
93
|
-
* ```js
|
|
94
|
-
* import test from 'node:test/reporters';
|
|
95
|
-
* ```
|
|
96
|
-
* @since v19.9.0
|
|
97
|
-
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/test/reporters.js)
|
|
94
|
+
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/test.js)
|
|
98
95
|
*/
|
|
99
96
|
|
|
100
97
|
declare module "node:test" {
|
|
101
|
-
import {
|
|
98
|
+
import { AssertMethodNames } from 'node:assert';
|
|
99
|
+
import { Readable, ReadableEventMap } from 'node:stream';
|
|
100
|
+
import { TestEvent } from 'node:test/reporters';
|
|
102
101
|
import TestFn = test.TestFn;
|
|
103
102
|
import TestOptions = test.TestOptions;
|
|
104
103
|
/**
|
|
@@ -261,14 +260,14 @@ declare module "node:test" {
|
|
|
261
260
|
/**
|
|
262
261
|
* Specifies the current working directory to be used by the test runner.
|
|
263
262
|
* Serves as the base path for resolving files according to the
|
|
264
|
-
* [test runner execution model](https://nodejs.org/docs/latest-
|
|
263
|
+
* [test runner execution model](https://nodejs.org/docs/latest-v25.x/api/test.html#test-runner-execution-model).
|
|
265
264
|
* @since v23.0.0
|
|
266
265
|
* @default process.cwd()
|
|
267
266
|
*/
|
|
268
267
|
cwd?: string | undefined;
|
|
269
268
|
/**
|
|
270
269
|
* An array containing the list of files to run. If omitted, files are run according to the
|
|
271
|
-
* [test runner execution model](https://nodejs.org/docs/latest-
|
|
270
|
+
* [test runner execution model](https://nodejs.org/docs/latest-v25.x/api/test.html#test-runner-execution-model).
|
|
272
271
|
*/
|
|
273
272
|
files?: readonly string[] | undefined;
|
|
274
273
|
/**
|
|
@@ -281,7 +280,7 @@ declare module "node:test" {
|
|
|
281
280
|
/**
|
|
282
281
|
* An array containing the list of glob patterns to match test files.
|
|
283
282
|
* This option cannot be used together with `files`. If omitted, files are run according to the
|
|
284
|
-
* [test runner execution model](https://nodejs.org/docs/latest-
|
|
283
|
+
* [test runner execution model](https://nodejs.org/docs/latest-v25.x/api/test.html#test-runner-execution-model).
|
|
285
284
|
* @since v22.6.0
|
|
286
285
|
*/
|
|
287
286
|
globPatterns?: readonly string[] | undefined;
|
|
@@ -362,7 +361,14 @@ declare module "node:test" {
|
|
|
362
361
|
*/
|
|
363
362
|
shard?: TestShard | undefined;
|
|
364
363
|
/**
|
|
365
|
-
*
|
|
364
|
+
* A file path where the test runner will
|
|
365
|
+
* store the state of the tests to allow rerunning only the failed tests on a next run.
|
|
366
|
+
* @since v24.7.0
|
|
367
|
+
* @default undefined
|
|
368
|
+
*/
|
|
369
|
+
rerunFailuresFilePath?: string | undefined;
|
|
370
|
+
/**
|
|
371
|
+
* enable [code coverage](https://nodejs.org/docs/latest-v25.x/api/test.html#collecting-code-coverage) collection.
|
|
366
372
|
* @since v22.10.0
|
|
367
373
|
* @default false
|
|
368
374
|
*/
|
|
@@ -409,6 +415,23 @@ declare module "node:test" {
|
|
|
409
415
|
*/
|
|
410
416
|
functionCoverage?: number | undefined;
|
|
411
417
|
}
|
|
418
|
+
interface TestsStreamEventMap extends ReadableEventMap {
|
|
419
|
+
"data": [data: TestEvent];
|
|
420
|
+
"test:coverage": [data: EventData.TestCoverage];
|
|
421
|
+
"test:complete": [data: EventData.TestComplete];
|
|
422
|
+
"test:dequeue": [data: EventData.TestDequeue];
|
|
423
|
+
"test:diagnostic": [data: EventData.TestDiagnostic];
|
|
424
|
+
"test:enqueue": [data: EventData.TestEnqueue];
|
|
425
|
+
"test:fail": [data: EventData.TestFail];
|
|
426
|
+
"test:pass": [data: EventData.TestPass];
|
|
427
|
+
"test:plan": [data: EventData.TestPlan];
|
|
428
|
+
"test:start": [data: EventData.TestStart];
|
|
429
|
+
"test:stderr": [data: EventData.TestStderr];
|
|
430
|
+
"test:stdout": [data: EventData.TestStdout];
|
|
431
|
+
"test:summary": [data: EventData.TestSummary];
|
|
432
|
+
"test:watch:drained": [];
|
|
433
|
+
"test:watch:restarted": [];
|
|
434
|
+
}
|
|
412
435
|
/**
|
|
413
436
|
* A successful call to `run()` will return a new `TestsStream` object, streaming a series of events representing the execution of the tests.
|
|
414
437
|
*
|
|
@@ -416,90 +439,59 @@ declare module "node:test" {
|
|
|
416
439
|
* @since v18.9.0, v16.19.0
|
|
417
440
|
*/
|
|
418
441
|
interface TestsStream extends Readable {
|
|
419
|
-
|
|
420
|
-
addListener
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
addListener(
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
once(event: "test:summary", listener: (data: EventData.TestSummary) => void): this;
|
|
473
|
-
once(event: "test:watch:drained", listener: () => void): this;
|
|
474
|
-
once(event: string, listener: (...args: any[]) => void): this;
|
|
475
|
-
prependListener(event: "test:coverage", listener: (data: EventData.TestCoverage) => void): this;
|
|
476
|
-
prependListener(event: "test:complete", listener: (data: EventData.TestComplete) => void): this;
|
|
477
|
-
prependListener(event: "test:dequeue", listener: (data: EventData.TestDequeue) => void): this;
|
|
478
|
-
prependListener(event: "test:diagnostic", listener: (data: EventData.TestDiagnostic) => void): this;
|
|
479
|
-
prependListener(event: "test:enqueue", listener: (data: EventData.TestEnqueue) => void): this;
|
|
480
|
-
prependListener(event: "test:fail", listener: (data: EventData.TestFail) => void): this;
|
|
481
|
-
prependListener(event: "test:pass", listener: (data: EventData.TestPass) => void): this;
|
|
482
|
-
prependListener(event: "test:plan", listener: (data: EventData.TestPlan) => void): this;
|
|
483
|
-
prependListener(event: "test:start", listener: (data: EventData.TestStart) => void): this;
|
|
484
|
-
prependListener(event: "test:stderr", listener: (data: EventData.TestStderr) => void): this;
|
|
485
|
-
prependListener(event: "test:stdout", listener: (data: EventData.TestStdout) => void): this;
|
|
486
|
-
prependListener(event: "test:summary", listener: (data: EventData.TestSummary) => void): this;
|
|
487
|
-
prependListener(event: "test:watch:drained", listener: () => void): this;
|
|
488
|
-
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
489
|
-
prependOnceListener(event: "test:coverage", listener: (data: EventData.TestCoverage) => void): this;
|
|
490
|
-
prependOnceListener(event: "test:complete", listener: (data: EventData.TestComplete) => void): this;
|
|
491
|
-
prependOnceListener(event: "test:dequeue", listener: (data: EventData.TestDequeue) => void): this;
|
|
492
|
-
prependOnceListener(event: "test:diagnostic", listener: (data: EventData.TestDiagnostic) => void): this;
|
|
493
|
-
prependOnceListener(event: "test:enqueue", listener: (data: EventData.TestEnqueue) => void): this;
|
|
494
|
-
prependOnceListener(event: "test:fail", listener: (data: EventData.TestFail) => void): this;
|
|
495
|
-
prependOnceListener(event: "test:pass", listener: (data: EventData.TestPass) => void): this;
|
|
496
|
-
prependOnceListener(event: "test:plan", listener: (data: EventData.TestPlan) => void): this;
|
|
497
|
-
prependOnceListener(event: "test:start", listener: (data: EventData.TestStart) => void): this;
|
|
498
|
-
prependOnceListener(event: "test:stderr", listener: (data: EventData.TestStderr) => void): this;
|
|
499
|
-
prependOnceListener(event: "test:stdout", listener: (data: EventData.TestStdout) => void): this;
|
|
500
|
-
prependOnceListener(event: "test:summary", listener: (data: EventData.TestSummary) => void): this;
|
|
501
|
-
prependOnceListener(event: "test:watch:drained", listener: () => void): this;
|
|
502
|
-
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
442
|
+
// #region InternalEventEmitter
|
|
443
|
+
addListener<E extends keyof TestsStreamEventMap>(
|
|
444
|
+
eventName: E,
|
|
445
|
+
listener: (...args: TestsStreamEventMap[E]) => void,
|
|
446
|
+
): this;
|
|
447
|
+
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
448
|
+
emit<E extends keyof TestsStreamEventMap>(eventName: E, ...args: TestsStreamEventMap[E]): boolean;
|
|
449
|
+
emit(eventName: string | symbol, ...args: any[]): boolean;
|
|
450
|
+
listenerCount<E extends keyof TestsStreamEventMap>(
|
|
451
|
+
eventName: E,
|
|
452
|
+
listener?: (...args: TestsStreamEventMap[E]) => void,
|
|
453
|
+
): number;
|
|
454
|
+
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
|
|
455
|
+
listeners<E extends keyof TestsStreamEventMap>(eventName: E): ((...args: TestsStreamEventMap[E]) => void)[];
|
|
456
|
+
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
|
457
|
+
off<E extends keyof TestsStreamEventMap>(
|
|
458
|
+
eventName: E,
|
|
459
|
+
listener: (...args: TestsStreamEventMap[E]) => void,
|
|
460
|
+
): this;
|
|
461
|
+
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
462
|
+
on<E extends keyof TestsStreamEventMap>(
|
|
463
|
+
eventName: E,
|
|
464
|
+
listener: (...args: TestsStreamEventMap[E]) => void,
|
|
465
|
+
): this;
|
|
466
|
+
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
467
|
+
once<E extends keyof TestsStreamEventMap>(
|
|
468
|
+
eventName: E,
|
|
469
|
+
listener: (...args: TestsStreamEventMap[E]) => void,
|
|
470
|
+
): this;
|
|
471
|
+
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
472
|
+
prependListener<E extends keyof TestsStreamEventMap>(
|
|
473
|
+
eventName: E,
|
|
474
|
+
listener: (...args: TestsStreamEventMap[E]) => void,
|
|
475
|
+
): this;
|
|
476
|
+
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
477
|
+
prependOnceListener<E extends keyof TestsStreamEventMap>(
|
|
478
|
+
eventName: E,
|
|
479
|
+
listener: (...args: TestsStreamEventMap[E]) => void,
|
|
480
|
+
): this;
|
|
481
|
+
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
482
|
+
rawListeners<E extends keyof TestsStreamEventMap>(
|
|
483
|
+
eventName: E,
|
|
484
|
+
): ((...args: TestsStreamEventMap[E]) => void)[];
|
|
485
|
+
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
|
486
|
+
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
487
|
+
removeAllListeners<E extends keyof TestsStreamEventMap>(eventName?: E): this;
|
|
488
|
+
removeAllListeners(eventName?: string | symbol): this;
|
|
489
|
+
removeListener<E extends keyof TestsStreamEventMap>(
|
|
490
|
+
eventName: E,
|
|
491
|
+
listener: (...args: TestsStreamEventMap[E]) => void,
|
|
492
|
+
): this;
|
|
493
|
+
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
494
|
+
// #endregion
|
|
503
495
|
}
|
|
504
496
|
namespace EventData {
|
|
505
497
|
interface Error extends globalThis.Error {
|
|
@@ -529,6 +521,14 @@ declare module "node:test" {
|
|
|
529
521
|
* The nesting level of the test.
|
|
530
522
|
*/
|
|
531
523
|
nesting: number;
|
|
524
|
+
/**
|
|
525
|
+
* The severity level of the diagnostic message.
|
|
526
|
+
* Possible values are:
|
|
527
|
+
* * `'info'`: Informational messages.
|
|
528
|
+
* * `'warn'`: Warnings.
|
|
529
|
+
* * `'error'`: Errors.
|
|
530
|
+
*/
|
|
531
|
+
level: "info" | "warn" | "error";
|
|
532
532
|
}
|
|
533
533
|
interface TestCoverage {
|
|
534
534
|
/**
|
|
@@ -715,7 +715,7 @@ declare module "node:test" {
|
|
|
715
715
|
/**
|
|
716
716
|
* The type of the test, used to denote whether this is a suite.
|
|
717
717
|
*/
|
|
718
|
-
type?: "suite";
|
|
718
|
+
type?: "suite" | "test";
|
|
719
719
|
};
|
|
720
720
|
/**
|
|
721
721
|
* The test name.
|
|
@@ -785,7 +785,13 @@ declare module "node:test" {
|
|
|
785
785
|
* The type of the test, used to denote whether this is a suite.
|
|
786
786
|
* @since v20.0.0, v19.9.0, v18.17.0
|
|
787
787
|
*/
|
|
788
|
-
type?: "suite";
|
|
788
|
+
type?: "suite" | "test";
|
|
789
|
+
/**
|
|
790
|
+
* The attempt number of the test run,
|
|
791
|
+
* present only when using the `--test-rerun-failures` flag.
|
|
792
|
+
* @since v24.7.0
|
|
793
|
+
*/
|
|
794
|
+
attempt?: number;
|
|
789
795
|
};
|
|
790
796
|
/**
|
|
791
797
|
* The test name.
|
|
@@ -821,7 +827,19 @@ declare module "node:test" {
|
|
|
821
827
|
* The type of the test, used to denote whether this is a suite.
|
|
822
828
|
* @since 20.0.0, 19.9.0, 18.17.0
|
|
823
829
|
*/
|
|
824
|
-
type?: "suite";
|
|
830
|
+
type?: "suite" | "test";
|
|
831
|
+
/**
|
|
832
|
+
* The attempt number of the test run,
|
|
833
|
+
* present only when using the `--test-rerun-failures` flag.
|
|
834
|
+
* @since v24.7.0
|
|
835
|
+
*/
|
|
836
|
+
attempt?: number;
|
|
837
|
+
/**
|
|
838
|
+
* The attempt number the test passed on,
|
|
839
|
+
* present only when using the `--test-rerun-failures` flag.
|
|
840
|
+
* @since v24.7.0
|
|
841
|
+
*/
|
|
842
|
+
passed_on_attempt?: number;
|
|
825
843
|
};
|
|
826
844
|
/**
|
|
827
845
|
* The test name.
|
|
@@ -966,6 +984,7 @@ declare module "node:test" {
|
|
|
966
984
|
* @since v22.2.0, v20.15.0
|
|
967
985
|
*/
|
|
968
986
|
readonly assert: TestContextAssert;
|
|
987
|
+
readonly attempt: number;
|
|
969
988
|
/**
|
|
970
989
|
* This function is used to create a hook running before subtest of the current test.
|
|
971
990
|
* @param fn The hook function. The first argument to this function is a `TestContext` object.
|
|
@@ -1176,29 +1195,7 @@ declare module "node:test" {
|
|
|
1176
1195
|
*/
|
|
1177
1196
|
readonly mock: MockTracker;
|
|
1178
1197
|
}
|
|
1179
|
-
interface TestContextAssert extends
|
|
1180
|
-
Pick<
|
|
1181
|
-
typeof import('node:assert'),
|
|
1182
|
-
| "deepEqual"
|
|
1183
|
-
| "deepStrictEqual"
|
|
1184
|
-
| "doesNotMatch"
|
|
1185
|
-
| "doesNotReject"
|
|
1186
|
-
| "doesNotThrow"
|
|
1187
|
-
| "equal"
|
|
1188
|
-
| "fail"
|
|
1189
|
-
| "ifError"
|
|
1190
|
-
| "match"
|
|
1191
|
-
| "notDeepEqual"
|
|
1192
|
-
| "notDeepStrictEqual"
|
|
1193
|
-
| "notEqual"
|
|
1194
|
-
| "notStrictEqual"
|
|
1195
|
-
| "ok"
|
|
1196
|
-
| "partialDeepStrictEqual"
|
|
1197
|
-
| "rejects"
|
|
1198
|
-
| "strictEqual"
|
|
1199
|
-
| "throws"
|
|
1200
|
-
>
|
|
1201
|
-
{
|
|
1198
|
+
interface TestContextAssert extends Pick<typeof import('node:assert'), AssertMethodNames> {
|
|
1202
1199
|
/**
|
|
1203
1200
|
* This function serializes `value` and writes it to the file specified by `path`.
|
|
1204
1201
|
*
|
|
@@ -1218,7 +1215,7 @@ declare module "node:test" {
|
|
|
1218
1215
|
* highlighting.
|
|
1219
1216
|
* @since v22.14.0
|
|
1220
1217
|
* @param value A value to serialize to a string. If Node.js was started with
|
|
1221
|
-
* the [`--test-update-snapshots`](https://nodejs.org/docs/latest-
|
|
1218
|
+
* the [`--test-update-snapshots`](https://nodejs.org/docs/latest-v25.x/api/cli.html#--test-update-snapshots)
|
|
1222
1219
|
* flag, the serialized value is written to
|
|
1223
1220
|
* `path`. Otherwise, the serialized value is compared to the contents of the
|
|
1224
1221
|
* existing snapshot file.
|
|
@@ -1241,7 +1238,7 @@ declare module "node:test" {
|
|
|
1241
1238
|
* ```
|
|
1242
1239
|
* @since v22.3.0
|
|
1243
1240
|
* @param value A value to serialize to a string. If Node.js was started with
|
|
1244
|
-
* the [`--test-update-snapshots`](https://nodejs.org/docs/latest-
|
|
1241
|
+
* the [`--test-update-snapshots`](https://nodejs.org/docs/latest-v25.x/api/cli.html#--test-update-snapshots)
|
|
1245
1242
|
* flag, the serialized value is written to
|
|
1246
1243
|
* the snapshot file. Otherwise, the serialized value is compared to the
|
|
1247
1244
|
* corresponding value in the existing snapshot file.
|
|
@@ -1672,7 +1669,7 @@ declare module "node:test" {
|
|
|
1672
1669
|
* This function is used to mock the exports of ECMAScript modules, CommonJS modules, JSON modules, and
|
|
1673
1670
|
* Node.js builtin modules. Any references to the original module prior to mocking are not impacted. In
|
|
1674
1671
|
* order to enable module mocking, Node.js must be started with the
|
|
1675
|
-
* [`--experimental-test-module-mocks`](https://nodejs.org/docs/latest-
|
|
1672
|
+
* [`--experimental-test-module-mocks`](https://nodejs.org/docs/latest-v25.x/api/cli.html#--experimental-test-module-mocks)
|
|
1676
1673
|
* command-line flag.
|
|
1677
1674
|
*
|
|
1678
1675
|
* The following example demonstrates how a mock is created for a module.
|
|
@@ -1712,6 +1709,46 @@ declare module "node:test" {
|
|
|
1712
1709
|
* @param options Optional configuration options for the mock module.
|
|
1713
1710
|
*/
|
|
1714
1711
|
module(specifier: string, options?: MockModuleOptions): MockModuleContext;
|
|
1712
|
+
/**
|
|
1713
|
+
* Creates a mock for a property value on an object. This allows you to track and control access to a specific property,
|
|
1714
|
+
* including how many times it is read (getter) or written (setter), and to restore the original value after mocking.
|
|
1715
|
+
*
|
|
1716
|
+
* ```js
|
|
1717
|
+
* test('mocks a property value', (t) => {
|
|
1718
|
+
* const obj = { foo: 42 };
|
|
1719
|
+
* const prop = t.mock.property(obj, 'foo', 100);
|
|
1720
|
+
*
|
|
1721
|
+
* assert.strictEqual(obj.foo, 100);
|
|
1722
|
+
* assert.strictEqual(prop.mock.accessCount(), 1);
|
|
1723
|
+
* assert.strictEqual(prop.mock.accesses[0].type, 'get');
|
|
1724
|
+
* assert.strictEqual(prop.mock.accesses[0].value, 100);
|
|
1725
|
+
*
|
|
1726
|
+
* obj.foo = 200;
|
|
1727
|
+
* assert.strictEqual(prop.mock.accessCount(), 2);
|
|
1728
|
+
* assert.strictEqual(prop.mock.accesses[1].type, 'set');
|
|
1729
|
+
* assert.strictEqual(prop.mock.accesses[1].value, 200);
|
|
1730
|
+
*
|
|
1731
|
+
* prop.mock.restore();
|
|
1732
|
+
* assert.strictEqual(obj.foo, 42);
|
|
1733
|
+
* });
|
|
1734
|
+
* ```
|
|
1735
|
+
* @since v24.3.0
|
|
1736
|
+
* @param object The object whose value is being mocked.
|
|
1737
|
+
* @param propertyName The identifier of the property on `object` to mock.
|
|
1738
|
+
* @param value An optional value used as the mock value
|
|
1739
|
+
* for `object[propertyName]`. **Default:** The original property value.
|
|
1740
|
+
* @returns A proxy to the mocked object. The mocked object contains a
|
|
1741
|
+
* special `mock` property, which is an instance of [`MockPropertyContext`][], and
|
|
1742
|
+
* can be used for inspecting and changing the behavior of the mocked property.
|
|
1743
|
+
*/
|
|
1744
|
+
property<
|
|
1745
|
+
MockedObject extends object,
|
|
1746
|
+
PropertyName extends keyof MockedObject,
|
|
1747
|
+
>(
|
|
1748
|
+
object: MockedObject,
|
|
1749
|
+
property: PropertyName,
|
|
1750
|
+
value?: MockedObject[PropertyName],
|
|
1751
|
+
): MockedObject & { mock: MockPropertyContext<MockedObject[PropertyName]> };
|
|
1715
1752
|
/**
|
|
1716
1753
|
* This function restores the default behavior of all mocks that were previously
|
|
1717
1754
|
* 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
|
|
@@ -1881,6 +1918,70 @@ declare module "node:test" {
|
|
|
1881
1918
|
*/
|
|
1882
1919
|
restore(): void;
|
|
1883
1920
|
}
|
|
1921
|
+
/**
|
|
1922
|
+
* @since v24.3.0
|
|
1923
|
+
*/
|
|
1924
|
+
class MockPropertyContext<PropertyType = any> {
|
|
1925
|
+
/**
|
|
1926
|
+
* A getter that returns a copy of the internal array used to track accesses (get/set) to
|
|
1927
|
+
* the mocked property. Each entry in the array is an object with the following properties:
|
|
1928
|
+
*/
|
|
1929
|
+
readonly accesses: Array<{
|
|
1930
|
+
type: "get" | "set";
|
|
1931
|
+
value: PropertyType;
|
|
1932
|
+
stack: Error;
|
|
1933
|
+
}>;
|
|
1934
|
+
/**
|
|
1935
|
+
* This function returns the number of times that the property was accessed.
|
|
1936
|
+
* This function is more efficient than checking `ctx.accesses.length` because
|
|
1937
|
+
* `ctx.accesses` is a getter that creates a copy of the internal access tracking array.
|
|
1938
|
+
* @returns The number of times that the property was accessed (read or written).
|
|
1939
|
+
*/
|
|
1940
|
+
accessCount(): number;
|
|
1941
|
+
/**
|
|
1942
|
+
* This function is used to change the value returned by the mocked property getter.
|
|
1943
|
+
* @param value The new value to be set as the mocked property value.
|
|
1944
|
+
*/
|
|
1945
|
+
mockImplementation(value: PropertyType): void;
|
|
1946
|
+
/**
|
|
1947
|
+
* This function is used to change the behavior of an existing mock for a single
|
|
1948
|
+
* invocation. Once invocation `onAccess` has occurred, the mock will revert to
|
|
1949
|
+
* whatever behavior it would have used had `mockImplementationOnce()` not been
|
|
1950
|
+
* called.
|
|
1951
|
+
*
|
|
1952
|
+
* The following example creates a mock function using `t.mock.property()`, calls the
|
|
1953
|
+
* mock property, changes the mock implementation to a different value for the
|
|
1954
|
+
* next invocation, and then resumes its previous behavior.
|
|
1955
|
+
*
|
|
1956
|
+
* ```js
|
|
1957
|
+
* test('changes a mock behavior once', (t) => {
|
|
1958
|
+
* const obj = { foo: 1 };
|
|
1959
|
+
*
|
|
1960
|
+
* const prop = t.mock.property(obj, 'foo', 5);
|
|
1961
|
+
*
|
|
1962
|
+
* assert.strictEqual(obj.foo, 5);
|
|
1963
|
+
* prop.mock.mockImplementationOnce(25);
|
|
1964
|
+
* assert.strictEqual(obj.foo, 25);
|
|
1965
|
+
* assert.strictEqual(obj.foo, 5);
|
|
1966
|
+
* });
|
|
1967
|
+
* ```
|
|
1968
|
+
* @param value The value to be used as the mock's
|
|
1969
|
+
* implementation for the invocation number specified by `onAccess`.
|
|
1970
|
+
* @param onAccess The invocation number that will use `value`. If
|
|
1971
|
+
* the specified invocation has already occurred then an exception is thrown.
|
|
1972
|
+
* **Default:** The number of the next invocation.
|
|
1973
|
+
*/
|
|
1974
|
+
mockImplementationOnce(value: PropertyType, onAccess?: number): void;
|
|
1975
|
+
/**
|
|
1976
|
+
* Resets the access history of the mocked property.
|
|
1977
|
+
*/
|
|
1978
|
+
resetAccesses(): void;
|
|
1979
|
+
/**
|
|
1980
|
+
* Resets the implementation of the mock property to its original behavior. The
|
|
1981
|
+
* mock can still be used after calling this function.
|
|
1982
|
+
*/
|
|
1983
|
+
restore(): void;
|
|
1984
|
+
}
|
|
1884
1985
|
interface MockTimersOptions {
|
|
1885
1986
|
apis: ReadonlyArray<"setInterval" | "setTimeout" | "setImmediate" | "Date">;
|
|
1886
1987
|
now?: number | Date | undefined;
|
|
@@ -2152,65 +2253,3 @@ declare module "node:test" {
|
|
|
2152
2253
|
}[keyof T];
|
|
2153
2254
|
export = test;
|
|
2154
2255
|
}
|
|
2155
|
-
declare module "node:test/reporters" {
|
|
2156
|
-
import { Transform, TransformOptions } from 'node:stream';
|
|
2157
|
-
import { EventData } from 'node:test';
|
|
2158
|
-
|
|
2159
|
-
type TestEvent =
|
|
2160
|
-
| { type: "test:coverage"; data: EventData.TestCoverage }
|
|
2161
|
-
| { type: "test:complete"; data: EventData.TestComplete }
|
|
2162
|
-
| { type: "test:dequeue"; data: EventData.TestDequeue }
|
|
2163
|
-
| { type: "test:diagnostic"; data: EventData.TestDiagnostic }
|
|
2164
|
-
| { type: "test:enqueue"; data: EventData.TestEnqueue }
|
|
2165
|
-
| { type: "test:fail"; data: EventData.TestFail }
|
|
2166
|
-
| { type: "test:pass"; data: EventData.TestPass }
|
|
2167
|
-
| { type: "test:plan"; data: EventData.TestPlan }
|
|
2168
|
-
| { type: "test:start"; data: EventData.TestStart }
|
|
2169
|
-
| { type: "test:stderr"; data: EventData.TestStderr }
|
|
2170
|
-
| { type: "test:stdout"; data: EventData.TestStdout }
|
|
2171
|
-
| { type: "test:summary"; data: EventData.TestSummary }
|
|
2172
|
-
| { type: "test:watch:drained"; data: undefined };
|
|
2173
|
-
type TestEventGenerator = AsyncGenerator<TestEvent, void>;
|
|
2174
|
-
|
|
2175
|
-
interface ReporterConstructorWrapper<T extends new(...args: any[]) => Transform> {
|
|
2176
|
-
new(...args: ConstructorParameters<T>): InstanceType<T>;
|
|
2177
|
-
(...args: ConstructorParameters<T>): InstanceType<T>;
|
|
2178
|
-
}
|
|
2179
|
-
|
|
2180
|
-
/**
|
|
2181
|
-
* The `dot` reporter outputs the test results in a compact format,
|
|
2182
|
-
* where each passing test is represented by a `.`,
|
|
2183
|
-
* and each failing test is represented by a `X`.
|
|
2184
|
-
* @since v20.0.0
|
|
2185
|
-
*/
|
|
2186
|
-
function dot(source: TestEventGenerator): AsyncGenerator<"\n" | "." | "X", void>;
|
|
2187
|
-
/**
|
|
2188
|
-
* The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format.
|
|
2189
|
-
* @since v20.0.0
|
|
2190
|
-
*/
|
|
2191
|
-
function tap(source: TestEventGenerator): AsyncGenerator<string, void>;
|
|
2192
|
-
class SpecReporter extends Transform {
|
|
2193
|
-
constructor();
|
|
2194
|
-
}
|
|
2195
|
-
/**
|
|
2196
|
-
* The `spec` reporter outputs the test results in a human-readable format.
|
|
2197
|
-
* @since v20.0.0
|
|
2198
|
-
*/
|
|
2199
|
-
const spec: ReporterConstructorWrapper<typeof SpecReporter>;
|
|
2200
|
-
/**
|
|
2201
|
-
* The `junit` reporter outputs test results in a jUnit XML format.
|
|
2202
|
-
* @since v21.0.0
|
|
2203
|
-
*/
|
|
2204
|
-
function junit(source: TestEventGenerator): AsyncGenerator<string, void>;
|
|
2205
|
-
class LcovReporter extends Transform {
|
|
2206
|
-
constructor(opts?: Omit<TransformOptions, "writableObjectMode">);
|
|
2207
|
-
}
|
|
2208
|
-
/**
|
|
2209
|
-
* The `lcov` reporter outputs test coverage when used with the
|
|
2210
|
-
* [`--experimental-test-coverage`](https://nodejs.org/docs/latest-v24.x/api/cli.html#--experimental-test-coverage) flag.
|
|
2211
|
-
* @since v22.0.0
|
|
2212
|
-
*/
|
|
2213
|
-
const lcov: ReporterConstructorWrapper<typeof LcovReporter>;
|
|
2214
|
-
|
|
2215
|
-
export { dot, junit, lcov, spec, tap, TestEvent };
|
|
2216
|
-
}
|
package/timers/promises.d.ts
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
// biome-ignore-all lint: generated file
|
|
2
|
+
// biome-ignore-all assist: generated file
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
|
|
6
|
+
/******************************************************************************
|
|
7
|
+
* GENERATED FILE, DO NOT MODIFY
|
|
8
|
+
* 这是生成的文件,千万不要修改
|
|
9
|
+
*
|
|
10
|
+
* @build-script/codegen - The Simple Code Generater
|
|
11
|
+
* https://github.com/GongT/baobao
|
|
12
|
+
*
|
|
13
|
+
******************************************************************************/
|
|
14
|
+
|
|
15
|
+
|
|
1
16
|
/**
|
|
2
17
|
* The `timers/promises` API provides an alternative set of timer functions
|
|
3
18
|
* that return `Promise` objects. The API is accessible via
|
|
@@ -11,7 +26,7 @@
|
|
|
11
26
|
* } from 'node:timers/promises';
|
|
12
27
|
* ```
|
|
13
28
|
* @since v15.0.0
|
|
14
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
29
|
+
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/timers/promises.js)
|
|
15
30
|
*/
|
|
16
31
|
|
|
17
32
|
declare module "node:timers/promises" {
|