@types/node 18.17.18 → 18.18.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.
- {node v18.17 → node v18.18}/README.md +1 -1
- node v18.18/assert/strict.d.ts +8 -0
- {node v18.17/ts4.8 → node v18.18}/assert.d.ts +48 -24
- {node v18.17 → node v18.18}/async_hooks.d.ts +10 -7
- {node v18.17 → node v18.18}/buffer.d.ts +32 -34
- {node v18.17 → node v18.18}/child_process.d.ts +267 -122
- {node v18.17/ts4.8 → node v18.18}/cluster.d.ts +107 -89
- {node v18.17/ts4.8 → node v18.18}/console.d.ts +7 -7
- node v18.18/constants.d.ts +19 -0
- {node v18.17 → node v18.18}/crypto.d.ts +746 -268
- {node v18.17/ts4.8 → node v18.18}/dgram.d.ts +86 -45
- {node v18.17 → node v18.18}/diagnostics_channel.d.ts +3 -3
- {node v18.17 → node v18.18}/dns/promises.d.ts +28 -25
- {node v18.17/ts4.8 → node v18.18}/dns.d.ts +203 -62
- node v18.18/dom-events.d.ts +122 -0
- {node v18.17/ts4.8 → node v18.18}/domain.d.ts +4 -4
- {node v18.17 → node v18.18}/events.d.ts +50 -7
- {node v18.17 → node v18.18}/fs/promises.d.ts +107 -73
- {node v18.17 → node v18.18}/fs.d.ts +513 -311
- {node v18.17 → node v18.18}/globals.d.ts +38 -18
- {node v18.17 → node v18.18}/http.d.ts +185 -185
- {node v18.17 → node v18.18}/http2.d.ts +628 -376
- {node v18.17/ts4.8 → node v18.18}/https.d.ts +107 -105
- {node v18.17 → node v18.18}/index.d.ts +1 -1
- {node v18.17/ts4.8 → node v18.18}/module.d.ts +56 -12
- {node v18.17/ts4.8 → node v18.18}/net.d.ts +123 -99
- {node v18.17/ts4.8 → node v18.18}/os.d.ts +7 -7
- {node v18.17 → node v18.18}/package.json +2 -2
- {node v18.17/ts4.8 → node v18.18}/path.d.ts +13 -13
- {node v18.17/ts4.8 → node v18.18}/perf_hooks.d.ts +20 -19
- {node v18.17/ts4.8 → node v18.18}/process.d.ts +155 -125
- {node v18.17 → node v18.18}/punycode.d.ts +3 -3
- {node v18.17/ts4.8 → node v18.18}/querystring.d.ts +14 -4
- {node v18.17 → node v18.18}/readline/promises.d.ts +5 -5
- {node v18.17/ts4.8 → node v18.18}/readline.d.ts +69 -56
- {node v18.17/ts4.8 → node v18.18}/repl.d.ts +67 -61
- {node v18.17 → node v18.18}/stream/consumers.d.ts +4 -4
- node v18.18/stream/promises.d.ts +83 -0
- {node v18.17 → node v18.18}/stream/web.d.ts +26 -20
- {node v18.17 → node v18.18}/stream.d.ts +361 -226
- {node v18.17/ts4.8 → node v18.18}/string_decoder.d.ts +3 -3
- {node v18.17 → node v18.18}/test.d.ts +131 -131
- {node v18.17 → node v18.18}/timers/promises.d.ts +4 -4
- {node v18.17 → node v18.18}/timers.d.ts +34 -9
- {node v18.17 → node v18.18}/tls.d.ts +151 -71
- {node v18.17/ts4.8 → node v18.18}/trace_events.d.ts +3 -3
- node v18.18/ts4.8/assert/strict.d.ts +8 -0
- {node v18.17 → node v18.18/ts4.8}/assert.d.ts +48 -24
- {node v18.17 → node v18.18}/ts4.8/async_hooks.d.ts +10 -7
- {node v18.17 → node v18.18}/ts4.8/buffer.d.ts +32 -34
- {node v18.17 → node v18.18}/ts4.8/child_process.d.ts +267 -122
- {node v18.17 → node v18.18/ts4.8}/cluster.d.ts +107 -89
- {node v18.17 → node v18.18/ts4.8}/console.d.ts +7 -7
- node v18.18/ts4.8/constants.d.ts +19 -0
- {node v18.17 → node v18.18}/ts4.8/crypto.d.ts +746 -268
- {node v18.17 → node v18.18/ts4.8}/dgram.d.ts +86 -45
- {node v18.17 → node v18.18}/ts4.8/diagnostics_channel.d.ts +3 -3
- {node v18.17 → node v18.18}/ts4.8/dns/promises.d.ts +28 -25
- {node v18.17 → node v18.18/ts4.8}/dns.d.ts +203 -62
- node v18.18/ts4.8/dom-events.d.ts +122 -0
- {node v18.17 → node v18.18/ts4.8}/domain.d.ts +4 -4
- {node v18.17 → node v18.18}/ts4.8/events.d.ts +50 -7
- {node v18.17 → node v18.18}/ts4.8/fs/promises.d.ts +107 -73
- {node v18.17 → node v18.18}/ts4.8/fs.d.ts +514 -312
- {node v18.17 → node v18.18}/ts4.8/globals.d.ts +68 -47
- {node v18.17 → node v18.18}/ts4.8/http.d.ts +185 -185
- {node v18.17 → node v18.18}/ts4.8/http2.d.ts +628 -376
- {node v18.17 → node v18.18/ts4.8}/https.d.ts +107 -105
- {node v18.17 → node v18.18/ts4.8}/module.d.ts +56 -12
- {node v18.17 → node v18.18/ts4.8}/net.d.ts +117 -93
- {node v18.17 → node v18.18/ts4.8}/os.d.ts +7 -7
- {node v18.17 → node v18.18/ts4.8}/path.d.ts +13 -13
- {node v18.17 → node v18.18/ts4.8}/perf_hooks.d.ts +20 -19
- {node v18.17 → node v18.18/ts4.8}/process.d.ts +155 -125
- {node v18.17 → node v18.18}/ts4.8/punycode.d.ts +3 -3
- {node v18.17 → node v18.18/ts4.8}/querystring.d.ts +14 -4
- {node v18.17 → node v18.18}/ts4.8/readline/promises.d.ts +5 -5
- {node v18.17 → node v18.18/ts4.8}/readline.d.ts +69 -56
- {node v18.17 → node v18.18/ts4.8}/repl.d.ts +67 -61
- {node v18.17 → node v18.18}/ts4.8/stream/consumers.d.ts +4 -4
- node v18.18/ts4.8/stream/promises.d.ts +83 -0
- {node v18.17 → node v18.18}/ts4.8/stream/web.d.ts +26 -20
- {node v18.17 → node v18.18}/ts4.8/stream.d.ts +490 -217
- {node v18.17 → node v18.18/ts4.8}/string_decoder.d.ts +3 -3
- {node v18.17 → node v18.18}/ts4.8/test.d.ts +144 -130
- {node v18.17 → node v18.18}/ts4.8/timers/promises.d.ts +4 -4
- {node v18.17 → node v18.18}/ts4.8/timers.d.ts +41 -9
- {node v18.17 → node v18.18}/ts4.8/tls.d.ts +151 -71
- {node v18.17 → node v18.18/ts4.8}/trace_events.d.ts +3 -3
- {node v18.17 → node v18.18}/ts4.8/tty.d.ts +10 -10
- {node v18.17 → node v18.18}/ts4.8/url.d.ts +39 -18
- {node v18.17 → node v18.18}/ts4.8/util.d.ts +178 -117
- {node v18.17 → node v18.18}/ts4.8/v8.d.ts +4 -4
- {node v18.17 → node v18.18}/ts4.8/vm.d.ts +60 -42
- {node v18.17 → node v18.18}/ts4.8/wasi.d.ts +3 -3
- {node v18.17 → node v18.18/ts4.8}/worker_threads.d.ts +82 -85
- {node v18.17 → node v18.18/ts4.8}/zlib.d.ts +9 -9
- {node v18.17 → node v18.18}/tty.d.ts +10 -10
- {node v18.17 → node v18.18}/url.d.ts +39 -18
- {node v18.17 → node v18.18}/util.d.ts +178 -117
- {node v18.17 → node v18.18}/v8.d.ts +4 -4
- {node v18.17 → node v18.18}/vm.d.ts +60 -42
- {node v18.17 → node v18.18}/wasi.d.ts +3 -3
- {node v18.17/ts4.8 → node v18.18}/worker_threads.d.ts +82 -85
- {node v18.17/ts4.8 → node v18.18}/zlib.d.ts +9 -9
- node v18.17/assert/strict.d.ts +0 -8
- node v18.17/constants.d.ts +0 -18
- node v18.17/dom-events.d.ts +0 -126
- node v18.17/stream/promises.d.ts +0 -42
- node v18.17/ts4.8/assert/strict.d.ts +0 -8
- node v18.17/ts4.8/constants.d.ts +0 -18
- node v18.17/ts4.8/dom-events.d.ts +0 -126
- node v18.17/ts4.8/stream/promises.d.ts +0 -42
- {node v18.17 → node v18.18}/LICENSE +0 -0
- {node v18.17 → node v18.18}/globals.global.d.ts +0 -0
- {node v18.17 → node v18.18}/inspector.d.ts +0 -0
- {node v18.17 → node v18.18}/ts4.8/globals.global.d.ts +0 -0
- {node v18.17 → node v18.18}/ts4.8/index.d.ts +0 -0
- {node v18.17 → node v18.18}/ts4.8/inspector.d.ts +0 -0
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
* ```
|
|
39
39
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/string_decoder.js)
|
|
40
40
|
*/
|
|
41
|
-
declare module
|
|
41
|
+
declare module "string_decoder" {
|
|
42
42
|
class StringDecoder {
|
|
43
43
|
constructor(encoding?: BufferEncoding);
|
|
44
44
|
/**
|
|
@@ -62,6 +62,6 @@ declare module 'string_decoder' {
|
|
|
62
62
|
end(buffer?: Buffer): string;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
declare module
|
|
66
|
-
export * from
|
|
65
|
+
declare module "node:string_decoder" {
|
|
66
|
+
export * from "string_decoder";
|
|
67
67
|
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* The `node:test` module provides a standalone testing module.
|
|
3
3
|
* @see [source](https://github.com/nodejs/node/blob/v18.x/lib/test.js)
|
|
4
4
|
*/
|
|
5
|
-
declare module
|
|
5
|
+
declare module "node:test" {
|
|
6
|
+
import { AsyncResource } from "node:async_hooks";
|
|
6
7
|
/**
|
|
7
8
|
* Programmatically start the test runner.
|
|
8
9
|
* @since v18.9.0
|
|
@@ -49,20 +50,7 @@ declare module 'node:test' {
|
|
|
49
50
|
function test(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
50
51
|
function test(fn?: TestFn): Promise<void>;
|
|
51
52
|
namespace test {
|
|
52
|
-
export {
|
|
53
|
-
after,
|
|
54
|
-
afterEach,
|
|
55
|
-
before,
|
|
56
|
-
beforeEach,
|
|
57
|
-
describe,
|
|
58
|
-
it,
|
|
59
|
-
run,
|
|
60
|
-
mock,
|
|
61
|
-
test,
|
|
62
|
-
skip,
|
|
63
|
-
todo,
|
|
64
|
-
only
|
|
65
|
-
};
|
|
53
|
+
export { after, afterEach, before, beforeEach, describe, it, mock, only, run, skip, test, todo };
|
|
66
54
|
}
|
|
67
55
|
/**
|
|
68
56
|
* @since v18.6.0
|
|
@@ -71,31 +59,33 @@ declare module 'node:test' {
|
|
|
71
59
|
* @param options Configuration options for the suite
|
|
72
60
|
* @param fn The function under suite. Default: A no-op function.
|
|
73
61
|
*/
|
|
74
|
-
function describe(name?: string, options?: TestOptions, fn?: SuiteFn): void
|
|
75
|
-
function describe(name?: string, fn?: SuiteFn): void
|
|
76
|
-
function describe(options?: TestOptions, fn?: SuiteFn): void
|
|
77
|
-
function describe(fn?: SuiteFn): void
|
|
62
|
+
function describe(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
63
|
+
function describe(name?: string, fn?: SuiteFn): Promise<void>;
|
|
64
|
+
function describe(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
65
|
+
function describe(fn?: SuiteFn): Promise<void>;
|
|
78
66
|
namespace describe {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
function skip(options?: TestOptions, fn?: SuiteFn): void
|
|
83
|
-
function skip(fn?: SuiteFn): void
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
function todo(fn?: SuiteFn): void
|
|
90
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Shorthand for skipping a suite, same as `describe([name], { skip: true }[, fn])`.
|
|
69
|
+
*/
|
|
70
|
+
function skip(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
71
|
+
function skip(name?: string, fn?: SuiteFn): Promise<void>;
|
|
72
|
+
function skip(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
73
|
+
function skip(fn?: SuiteFn): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Shorthand for marking a suite as `TODO`, same as `describe([name], { todo: true }[, fn])`.
|
|
76
|
+
*/
|
|
77
|
+
function todo(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
78
|
+
function todo(name?: string, fn?: SuiteFn): Promise<void>;
|
|
79
|
+
function todo(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
80
|
+
function todo(fn?: SuiteFn): Promise<void>;
|
|
91
81
|
/**
|
|
92
82
|
* Shorthand for marking a suite as `only`, same as `describe([name], { only: true }[, fn])`.
|
|
93
83
|
* @since v18.15.0
|
|
94
84
|
*/
|
|
95
|
-
function only(name?: string, options?: TestOptions, fn?: SuiteFn): void
|
|
96
|
-
function only(name?: string, fn?: SuiteFn): void
|
|
97
|
-
function only(options?: TestOptions, fn?: SuiteFn): void
|
|
98
|
-
function only(fn?: SuiteFn): void
|
|
85
|
+
function only(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
86
|
+
function only(name?: string, fn?: SuiteFn): Promise<void>;
|
|
87
|
+
function only(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
88
|
+
function only(fn?: SuiteFn): Promise<void>;
|
|
99
89
|
}
|
|
100
90
|
|
|
101
91
|
/**
|
|
@@ -106,31 +96,33 @@ declare module 'node:test' {
|
|
|
106
96
|
* @param fn The function under test. If the test uses callbacks, the callback function is
|
|
107
97
|
* passed as the second argument. Default: A no-op function.
|
|
108
98
|
*/
|
|
109
|
-
function it(name?: string, options?: TestOptions, fn?: TestFn): void
|
|
110
|
-
function it(name?: string, fn?: TestFn): void
|
|
111
|
-
function it(options?: TestOptions, fn?: TestFn): void
|
|
112
|
-
function it(fn?: TestFn): void
|
|
99
|
+
function it(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
100
|
+
function it(name?: string, fn?: TestFn): Promise<void>;
|
|
101
|
+
function it(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
102
|
+
function it(fn?: TestFn): Promise<void>;
|
|
113
103
|
namespace it {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
function skip(options?: TestOptions, fn?: TestFn): void
|
|
118
|
-
function skip(fn?: TestFn): void
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
function todo(fn?: TestFn): void
|
|
125
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Shorthand for skipping a test, same as `it([name], { skip: true }[, fn])`.
|
|
106
|
+
*/
|
|
107
|
+
function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
108
|
+
function skip(name?: string, fn?: TestFn): Promise<void>;
|
|
109
|
+
function skip(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
110
|
+
function skip(fn?: TestFn): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Shorthand for marking a test as `TODO`, same as `it([name], { todo: true }[, fn])`.
|
|
113
|
+
*/
|
|
114
|
+
function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
115
|
+
function todo(name?: string, fn?: TestFn): Promise<void>;
|
|
116
|
+
function todo(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
117
|
+
function todo(fn?: TestFn): Promise<void>;
|
|
126
118
|
/**
|
|
127
119
|
* Shorthand for marking a test as `only`, same as `it([name], { only: true }[, fn])`.
|
|
128
120
|
* @since v18.15.0
|
|
129
121
|
*/
|
|
130
|
-
function only(name?: string, options?: TestOptions, fn?: TestFn): void
|
|
131
|
-
function only(name?: string, fn?: TestFn): void
|
|
132
|
-
function only(options?: TestOptions, fn?: TestFn): void
|
|
133
|
-
function only(fn?: TestFn): void
|
|
122
|
+
function only(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
123
|
+
function only(name?: string, fn?: TestFn): Promise<void>;
|
|
124
|
+
function only(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
125
|
+
function only(fn?: TestFn): Promise<void>;
|
|
134
126
|
}
|
|
135
127
|
/**
|
|
136
128
|
* Shorthand for skipping a test, same as `test([name], { skip: true }[, fn])`.
|
|
@@ -204,6 +196,30 @@ declare module 'node:test' {
|
|
|
204
196
|
* incremented from the primary's `process.debugPort`.
|
|
205
197
|
*/
|
|
206
198
|
inspectPort?: number | (() => number) | undefined;
|
|
199
|
+
/**
|
|
200
|
+
* That can be used to only run tests whose name matches the provided pattern.
|
|
201
|
+
* Test name patterns are interpreted as JavaScript regular expressions.
|
|
202
|
+
* For each test that is executed, any corresponding test hooks, such as `beforeEach()`, are also run.
|
|
203
|
+
*/
|
|
204
|
+
testNamePatterns?: string | RegExp | string[] | RegExp[];
|
|
205
|
+
/**
|
|
206
|
+
* A function that accepts the TestsStream instance and can be used to setup listeners before any tests are run.
|
|
207
|
+
*/
|
|
208
|
+
setup?: (root: Test) => void | Promise<void>;
|
|
209
|
+
/**
|
|
210
|
+
* Whether to run in watch mode or not.
|
|
211
|
+
* @default false
|
|
212
|
+
*/
|
|
213
|
+
watch?: boolean | undefined;
|
|
214
|
+
}
|
|
215
|
+
class Test extends AsyncResource {
|
|
216
|
+
concurrency: number;
|
|
217
|
+
nesting: number;
|
|
218
|
+
only: boolean;
|
|
219
|
+
reporter: TestsStream;
|
|
220
|
+
runOnlySubtests: boolean;
|
|
221
|
+
testNumber: number;
|
|
222
|
+
timeout: number | null;
|
|
207
223
|
}
|
|
208
224
|
|
|
209
225
|
/**
|
|
@@ -213,53 +229,53 @@ declare module 'node:test' {
|
|
|
213
229
|
* @since v18.9.0
|
|
214
230
|
*/
|
|
215
231
|
interface TestsStream extends NodeJS.ReadableStream {
|
|
216
|
-
addListener(event:
|
|
217
|
-
addListener(event:
|
|
218
|
-
addListener(event:
|
|
219
|
-
addListener(event:
|
|
220
|
-
addListener(event:
|
|
221
|
-
addListener(event:
|
|
222
|
-
addListener(event:
|
|
232
|
+
addListener(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this;
|
|
233
|
+
addListener(event: "test:fail", listener: (data: TestFail) => void): this;
|
|
234
|
+
addListener(event: "test:pass", listener: (data: TestPass) => void): this;
|
|
235
|
+
addListener(event: "test:plan", listener: (data: TestPlan) => void): this;
|
|
236
|
+
addListener(event: "test:start", listener: (data: TestStart) => void): this;
|
|
237
|
+
addListener(event: "test:stderr", listener: (data: TestStderr) => void): this;
|
|
238
|
+
addListener(event: "test:stdout", listener: (data: TestStdout) => void): this;
|
|
223
239
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
224
|
-
emit(event:
|
|
225
|
-
emit(event:
|
|
226
|
-
emit(event:
|
|
227
|
-
emit(event:
|
|
228
|
-
emit(event:
|
|
229
|
-
emit(event:
|
|
230
|
-
emit(event:
|
|
240
|
+
emit(event: "test:diagnostic", data: DiagnosticData): boolean;
|
|
241
|
+
emit(event: "test:fail", data: TestFail): boolean;
|
|
242
|
+
emit(event: "test:pass", data: TestPass): boolean;
|
|
243
|
+
emit(event: "test:plan", data: TestPlan): boolean;
|
|
244
|
+
emit(event: "test:start", data: TestStart): boolean;
|
|
245
|
+
emit(event: "test:stderr", data: TestStderr): boolean;
|
|
246
|
+
emit(event: "test:stdout", data: TestStdout): boolean;
|
|
231
247
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
232
|
-
on(event:
|
|
233
|
-
on(event:
|
|
234
|
-
on(event:
|
|
235
|
-
on(event:
|
|
236
|
-
on(event:
|
|
237
|
-
on(event:
|
|
238
|
-
on(event:
|
|
248
|
+
on(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this;
|
|
249
|
+
on(event: "test:fail", listener: (data: TestFail) => void): this;
|
|
250
|
+
on(event: "test:pass", listener: (data: TestPass) => void): this;
|
|
251
|
+
on(event: "test:plan", listener: (data: TestPlan) => void): this;
|
|
252
|
+
on(event: "test:start", listener: (data: TestStart) => void): this;
|
|
253
|
+
on(event: "test:stderr", listener: (data: TestStderr) => void): this;
|
|
254
|
+
on(event: "test:stdout", listener: (data: TestStdout) => void): this;
|
|
239
255
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
240
|
-
once(event:
|
|
241
|
-
once(event:
|
|
242
|
-
once(event:
|
|
243
|
-
once(event:
|
|
244
|
-
once(event:
|
|
245
|
-
once(event:
|
|
246
|
-
once(event:
|
|
256
|
+
once(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this;
|
|
257
|
+
once(event: "test:fail", listener: (data: TestFail) => void): this;
|
|
258
|
+
once(event: "test:pass", listener: (data: TestPass) => void): this;
|
|
259
|
+
once(event: "test:plan", listener: (data: TestPlan) => void): this;
|
|
260
|
+
once(event: "test:start", listener: (data: TestStart) => void): this;
|
|
261
|
+
once(event: "test:stderr", listener: (data: TestStderr) => void): this;
|
|
262
|
+
once(event: "test:stdout", listener: (data: TestStdout) => void): this;
|
|
247
263
|
once(event: string, listener: (...args: any[]) => void): this;
|
|
248
|
-
prependListener(event:
|
|
249
|
-
prependListener(event:
|
|
250
|
-
prependListener(event:
|
|
251
|
-
prependListener(event:
|
|
252
|
-
prependListener(event:
|
|
253
|
-
prependListener(event:
|
|
254
|
-
prependListener(event:
|
|
264
|
+
prependListener(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this;
|
|
265
|
+
prependListener(event: "test:fail", listener: (data: TestFail) => void): this;
|
|
266
|
+
prependListener(event: "test:pass", listener: (data: TestPass) => void): this;
|
|
267
|
+
prependListener(event: "test:plan", listener: (data: TestPlan) => void): this;
|
|
268
|
+
prependListener(event: "test:start", listener: (data: TestStart) => void): this;
|
|
269
|
+
prependListener(event: "test:stderr", listener: (data: TestStderr) => void): this;
|
|
270
|
+
prependListener(event: "test:stdout", listener: (data: TestStdout) => void): this;
|
|
255
271
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
256
|
-
prependOnceListener(event:
|
|
257
|
-
prependOnceListener(event:
|
|
258
|
-
prependOnceListener(event:
|
|
259
|
-
prependOnceListener(event:
|
|
260
|
-
prependOnceListener(event:
|
|
261
|
-
prependOnceListener(event:
|
|
262
|
-
prependOnceListener(event:
|
|
272
|
+
prependOnceListener(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this;
|
|
273
|
+
prependOnceListener(event: "test:fail", listener: (data: TestFail) => void): this;
|
|
274
|
+
prependOnceListener(event: "test:pass", listener: (data: TestPass) => void): this;
|
|
275
|
+
prependOnceListener(event: "test:plan", listener: (data: TestPlan) => void): this;
|
|
276
|
+
prependOnceListener(event: "test:start", listener: (data: TestStart) => void): this;
|
|
277
|
+
prependOnceListener(event: "test:stderr", listener: (data: TestStderr) => void): this;
|
|
278
|
+
prependOnceListener(event: "test:stdout", listener: (data: TestStdout) => void): this;
|
|
263
279
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
264
280
|
}
|
|
265
281
|
|
|
@@ -540,7 +556,11 @@ declare module 'node:test' {
|
|
|
540
556
|
* @param options Optional configuration options for the mock function.
|
|
541
557
|
*/
|
|
542
558
|
fn<F extends Function = NoOpFunction>(original?: F, options?: MockFunctionOptions): Mock<F>;
|
|
543
|
-
fn<F extends Function = NoOpFunction, Implementation extends Function = F>(
|
|
559
|
+
fn<F extends Function = NoOpFunction, Implementation extends Function = F>(
|
|
560
|
+
original?: F,
|
|
561
|
+
implementation?: Implementation,
|
|
562
|
+
options?: MockFunctionOptions,
|
|
563
|
+
): Mock<F | Implementation>;
|
|
544
564
|
|
|
545
565
|
/**
|
|
546
566
|
* This function is used to create a mock on an existing object method.
|
|
@@ -556,8 +576,7 @@ declare module 'node:test' {
|
|
|
556
576
|
object: MockedObject,
|
|
557
577
|
methodName: MethodName,
|
|
558
578
|
options?: MockFunctionOptions,
|
|
559
|
-
): MockedObject[MethodName] extends Function
|
|
560
|
-
? Mock<MockedObject[MethodName]>
|
|
579
|
+
): MockedObject[MethodName] extends Function ? Mock<MockedObject[MethodName]>
|
|
561
580
|
: never;
|
|
562
581
|
method<
|
|
563
582
|
MockedObject extends object,
|
|
@@ -568,8 +587,7 @@ declare module 'node:test' {
|
|
|
568
587
|
methodName: MethodName,
|
|
569
588
|
implementation: Implementation,
|
|
570
589
|
options?: MockFunctionOptions,
|
|
571
|
-
): MockedObject[MethodName] extends Function
|
|
572
|
-
? Mock<MockedObject[MethodName] | Implementation>
|
|
590
|
+
): MockedObject[MethodName] extends Function ? Mock<MockedObject[MethodName] | Implementation>
|
|
573
591
|
: never;
|
|
574
592
|
method<MockedObject extends object>(
|
|
575
593
|
object: MockedObject,
|
|
@@ -648,16 +666,12 @@ declare module 'node:test' {
|
|
|
648
666
|
|
|
649
667
|
interface MockFunctionCall<
|
|
650
668
|
F extends Function,
|
|
651
|
-
ReturnType = F extends (...args: any) => infer T
|
|
652
|
-
? T
|
|
653
|
-
:
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
? Y
|
|
658
|
-
: F extends abstract new (...args: infer Y) => any
|
|
659
|
-
? Y
|
|
660
|
-
: unknown[],
|
|
669
|
+
ReturnType = F extends (...args: any) => infer T ? T
|
|
670
|
+
: F extends abstract new(...args: any) => infer T ? T
|
|
671
|
+
: unknown,
|
|
672
|
+
Args = F extends (...args: infer Y) => any ? Y
|
|
673
|
+
: F extends abstract new(...args: infer Y) => any ? Y
|
|
674
|
+
: unknown[],
|
|
661
675
|
> {
|
|
662
676
|
/**
|
|
663
677
|
* An array of the arguments passed to the mock function.
|
|
@@ -681,7 +695,7 @@ declare module 'node:test' {
|
|
|
681
695
|
* If the mocked function is a constructor, this field contains the class being constructed.
|
|
682
696
|
* Otherwise this will be `undefined`.
|
|
683
697
|
*/
|
|
684
|
-
target: F extends abstract new
|
|
698
|
+
target: F extends abstract new(...args: any) => any ? F : undefined;
|
|
685
699
|
/**
|
|
686
700
|
* The mocked function's `this` value.
|
|
687
701
|
*/
|
|
@@ -729,7 +743,7 @@ declare module 'node:test' {
|
|
|
729
743
|
restore(): void;
|
|
730
744
|
}
|
|
731
745
|
|
|
732
|
-
export {
|
|
746
|
+
export { after, afterEach, before, beforeEach, describe, it, mock, run, test, test as default };
|
|
733
747
|
}
|
|
734
748
|
|
|
735
749
|
interface DiagnosticData {
|
|
@@ -763,7 +777,7 @@ interface TestFail {
|
|
|
763
777
|
* The type of the test, used to denote whether this is a suite.
|
|
764
778
|
* @since 18.17.0
|
|
765
779
|
*/
|
|
766
|
-
type?:
|
|
780
|
+
type?: "suite";
|
|
767
781
|
};
|
|
768
782
|
/**
|
|
769
783
|
* The test name.
|
|
@@ -803,7 +817,7 @@ interface TestPass {
|
|
|
803
817
|
* The type of the test, used to denote whether this is a suite.
|
|
804
818
|
* @since 18.17.0
|
|
805
819
|
*/
|
|
806
|
-
type?:
|
|
820
|
+
type?: "suite";
|
|
807
821
|
};
|
|
808
822
|
/**
|
|
809
823
|
* The test name.
|
|
@@ -924,20 +938,20 @@ interface TestDequeue {
|
|
|
924
938
|
* @since v18.17.0
|
|
925
939
|
* @see [source](https://github.com/nodejs/node/blob/v18.17.0/lib/test/reporters.js)
|
|
926
940
|
*/
|
|
927
|
-
declare module
|
|
928
|
-
import { Transform } from
|
|
941
|
+
declare module "node:test/reporters" {
|
|
942
|
+
import { Transform } from "node:stream";
|
|
929
943
|
|
|
930
944
|
type TestEvent =
|
|
931
|
-
| { type:
|
|
932
|
-
| { type:
|
|
933
|
-
| { type:
|
|
934
|
-
| { type:
|
|
935
|
-
| { type:
|
|
936
|
-
| { type:
|
|
937
|
-
| { type:
|
|
938
|
-
| { type:
|
|
939
|
-
| { type:
|
|
940
|
-
| { type:
|
|
945
|
+
| { type: "test:diagnostic"; data: DiagnosticData }
|
|
946
|
+
| { type: "test:fail"; data: TestFail }
|
|
947
|
+
| { type: "test:pass"; data: TestPass }
|
|
948
|
+
| { type: "test:plan"; data: TestPlan }
|
|
949
|
+
| { type: "test:start"; data: TestStart }
|
|
950
|
+
| { type: "test:stderr"; data: TestStderr }
|
|
951
|
+
| { type: "test:stdout"; data: TestStdout }
|
|
952
|
+
| { type: "test:enqueue"; data: TestEnqueue }
|
|
953
|
+
| { type: "test:dequeue"; data: TestDequeue }
|
|
954
|
+
| { type: "test:watch:drained" };
|
|
941
955
|
type TestEventGenerator = AsyncGenerator<TestEvent, void>;
|
|
942
956
|
|
|
943
957
|
/**
|
|
@@ -945,7 +959,7 @@ declare module 'node:test/reporters' {
|
|
|
945
959
|
* where each passing test is represented by a `.`,
|
|
946
960
|
* and each failing test is represented by a `X`.
|
|
947
961
|
*/
|
|
948
|
-
function dot(source: TestEventGenerator): AsyncGenerator<
|
|
962
|
+
function dot(source: TestEventGenerator): AsyncGenerator<"\n" | "." | "X", void>;
|
|
949
963
|
/**
|
|
950
964
|
* The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format.
|
|
951
965
|
*/
|
|
@@ -956,5 +970,5 @@ declare module 'node:test/reporters' {
|
|
|
956
970
|
class Spec extends Transform {
|
|
957
971
|
constructor();
|
|
958
972
|
}
|
|
959
|
-
export { dot,
|
|
973
|
+
export { dot, Spec as spec, tap, TestEvent };
|
|
960
974
|
}
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* ```
|
|
12
12
|
* @since v15.0.0
|
|
13
13
|
*/
|
|
14
|
-
declare module
|
|
15
|
-
import { TimerOptions } from
|
|
14
|
+
declare module "timers/promises" {
|
|
15
|
+
import { TimerOptions } from "node:timers";
|
|
16
16
|
/**
|
|
17
17
|
* ```js
|
|
18
18
|
* import {
|
|
@@ -88,6 +88,6 @@ declare module 'timers/promises' {
|
|
|
88
88
|
|
|
89
89
|
const scheduler: Scheduler;
|
|
90
90
|
}
|
|
91
|
-
declare module
|
|
92
|
-
export * from
|
|
91
|
+
declare module "node:timers/promises" {
|
|
92
|
+
export * from "timers/promises";
|
|
93
93
|
}
|
|
@@ -8,9 +8,13 @@
|
|
|
8
8
|
* built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout).
|
|
9
9
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/timers.js)
|
|
10
10
|
*/
|
|
11
|
-
declare module
|
|
12
|
-
import { Abortable } from
|
|
13
|
-
import {
|
|
11
|
+
declare module "timers" {
|
|
12
|
+
import { Abortable } from "node:events";
|
|
13
|
+
import {
|
|
14
|
+
setImmediate as setImmediatePromise,
|
|
15
|
+
setInterval as setIntervalPromise,
|
|
16
|
+
setTimeout as setTimeoutPromise,
|
|
17
|
+
} from "node:timers/promises";
|
|
14
18
|
interface TimerOptions extends Abortable {
|
|
15
19
|
/**
|
|
16
20
|
* Set to `false` to indicate that the scheduled `Timeout`
|
|
@@ -40,6 +44,11 @@ declare module 'timers' {
|
|
|
40
44
|
*/
|
|
41
45
|
hasRef(): boolean;
|
|
42
46
|
_onImmediate: Function; // to distinguish it from the Timeout class
|
|
47
|
+
/**
|
|
48
|
+
* Cancels the immediate. This is similar to calling `clearImmediate()`.
|
|
49
|
+
* @since v18.18.0
|
|
50
|
+
*/
|
|
51
|
+
[Symbol.dispose](): void;
|
|
43
52
|
}
|
|
44
53
|
interface Timeout extends Timer {
|
|
45
54
|
/**
|
|
@@ -60,9 +69,25 @@ declare module 'timers' {
|
|
|
60
69
|
*/
|
|
61
70
|
refresh(): this;
|
|
62
71
|
[Symbol.toPrimitive](): number;
|
|
72
|
+
/**
|
|
73
|
+
* Cancels the timeout.
|
|
74
|
+
* @since v18.18.0
|
|
75
|
+
*/
|
|
76
|
+
[Symbol.dispose](): void;
|
|
63
77
|
}
|
|
64
78
|
}
|
|
65
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Schedules execution of a one-time `callback` after `delay` milliseconds. The `callback` will likely not be invoked in precisely `delay` milliseconds.
|
|
81
|
+
* Node.js makes no guarantees about the exact timing of when callbacks will fire, nor of their ordering. The callback will be called as close as possible to the time specified.
|
|
82
|
+
* When `delay` is larger than `2147483647` or less than `1`, the `delay` will be set to `1`. Non-integer delays are truncated to an integer.
|
|
83
|
+
* If `callback` is not a function, a [TypeError](https://nodejs.org/api/errors.html#class-typeerror) will be thrown.
|
|
84
|
+
* @since v0.0.1
|
|
85
|
+
*/
|
|
86
|
+
function setTimeout<TArgs extends any[]>(
|
|
87
|
+
callback: (...args: TArgs) => void,
|
|
88
|
+
ms?: number,
|
|
89
|
+
...args: TArgs
|
|
90
|
+
): NodeJS.Timeout;
|
|
66
91
|
// util.promisify no rest args compability
|
|
67
92
|
// tslint:disable-next-line void-return
|
|
68
93
|
function setTimeout(callback: (args: void) => void, ms?: number): NodeJS.Timeout;
|
|
@@ -70,15 +95,22 @@ declare module 'timers' {
|
|
|
70
95
|
const __promisify__: typeof setTimeoutPromise;
|
|
71
96
|
}
|
|
72
97
|
function clearTimeout(timeoutId: NodeJS.Timeout | string | number | undefined): void;
|
|
73
|
-
function setInterval<TArgs extends any[]>(
|
|
98
|
+
function setInterval<TArgs extends any[]>(
|
|
99
|
+
callback: (...args: TArgs) => void,
|
|
100
|
+
ms?: number,
|
|
101
|
+
...args: TArgs
|
|
102
|
+
): NodeJS.Timeout;
|
|
74
103
|
// util.promisify no rest args compability
|
|
75
104
|
// tslint:disable-next-line void-return
|
|
76
|
-
function setInterval(callback: (args: void) => void, ms?: number): NodeJS.
|
|
105
|
+
function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timeout;
|
|
77
106
|
namespace setInterval {
|
|
78
107
|
const __promisify__: typeof setIntervalPromise;
|
|
79
108
|
}
|
|
80
109
|
function clearInterval(intervalId: NodeJS.Timeout | string | number | undefined): void;
|
|
81
|
-
function setImmediate<TArgs extends any[]>(
|
|
110
|
+
function setImmediate<TArgs extends any[]>(
|
|
111
|
+
callback: (...args: TArgs) => void,
|
|
112
|
+
...args: TArgs
|
|
113
|
+
): NodeJS.Immediate;
|
|
82
114
|
// util.promisify no rest args compability
|
|
83
115
|
// tslint:disable-next-line void-return
|
|
84
116
|
function setImmediate(callback: (args: void) => void): NodeJS.Immediate;
|
|
@@ -89,6 +121,6 @@ declare module 'timers' {
|
|
|
89
121
|
function queueMicrotask(callback: () => void): void;
|
|
90
122
|
}
|
|
91
123
|
}
|
|
92
|
-
declare module
|
|
93
|
-
export * from
|
|
124
|
+
declare module "node:timers" {
|
|
125
|
+
export * from "timers";
|
|
94
126
|
}
|