@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,8 +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
|
|
6
|
-
import { AsyncResource } from
|
|
5
|
+
declare module "node:test" {
|
|
6
|
+
import { AsyncResource } from "node:async_hooks";
|
|
7
7
|
/**
|
|
8
8
|
* Programmatically start the test runner.
|
|
9
9
|
* @since v18.9.0
|
|
@@ -50,20 +50,7 @@ declare module 'node:test' {
|
|
|
50
50
|
function test(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
51
51
|
function test(fn?: TestFn): Promise<void>;
|
|
52
52
|
namespace test {
|
|
53
|
-
export {
|
|
54
|
-
after,
|
|
55
|
-
afterEach,
|
|
56
|
-
before,
|
|
57
|
-
beforeEach,
|
|
58
|
-
describe,
|
|
59
|
-
it,
|
|
60
|
-
run,
|
|
61
|
-
mock,
|
|
62
|
-
test,
|
|
63
|
-
skip,
|
|
64
|
-
todo,
|
|
65
|
-
only
|
|
66
|
-
};
|
|
53
|
+
export { after, afterEach, before, beforeEach, describe, it, mock, only, run, skip, test, todo };
|
|
67
54
|
}
|
|
68
55
|
/**
|
|
69
56
|
* @since v18.6.0
|
|
@@ -72,31 +59,33 @@ declare module 'node:test' {
|
|
|
72
59
|
* @param options Configuration options for the suite
|
|
73
60
|
* @param fn The function under suite. Default: A no-op function.
|
|
74
61
|
*/
|
|
75
|
-
function describe(name?: string, options?: TestOptions, fn?: SuiteFn): void
|
|
76
|
-
function describe(name?: string, fn?: SuiteFn): void
|
|
77
|
-
function describe(options?: TestOptions, fn?: SuiteFn): void
|
|
78
|
-
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>;
|
|
79
66
|
namespace describe {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
function skip(options?: TestOptions, fn?: SuiteFn): void
|
|
84
|
-
function skip(fn?: SuiteFn): void
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
function todo(fn?: SuiteFn): void
|
|
91
|
-
|
|
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>;
|
|
92
81
|
/**
|
|
93
82
|
* Shorthand for marking a suite as `only`, same as `describe([name], { only: true }[, fn])`.
|
|
94
83
|
* @since v18.15.0
|
|
95
84
|
*/
|
|
96
|
-
function only(name?: string, options?: TestOptions, fn?: SuiteFn): void
|
|
97
|
-
function only(name?: string, fn?: SuiteFn): void
|
|
98
|
-
function only(options?: TestOptions, fn?: SuiteFn): void
|
|
99
|
-
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>;
|
|
100
89
|
}
|
|
101
90
|
|
|
102
91
|
/**
|
|
@@ -107,31 +96,33 @@ declare module 'node:test' {
|
|
|
107
96
|
* @param fn The function under test. If the test uses callbacks, the callback function is
|
|
108
97
|
* passed as the second argument. Default: A no-op function.
|
|
109
98
|
*/
|
|
110
|
-
function it(name?: string, options?: TestOptions, fn?: TestFn): void
|
|
111
|
-
function it(name?: string, fn?: TestFn): void
|
|
112
|
-
function it(options?: TestOptions, fn?: TestFn): void
|
|
113
|
-
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>;
|
|
114
103
|
namespace it {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
function skip(options?: TestOptions, fn?: TestFn): void
|
|
119
|
-
function skip(fn?: TestFn): void
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
function todo(fn?: TestFn): void
|
|
126
|
-
|
|
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>;
|
|
127
118
|
/**
|
|
128
119
|
* Shorthand for marking a test as `only`, same as `it([name], { only: true }[, fn])`.
|
|
129
120
|
* @since v18.15.0
|
|
130
121
|
*/
|
|
131
|
-
function only(name?: string, options?: TestOptions, fn?: TestFn): void
|
|
132
|
-
function only(name?: string, fn?: TestFn): void
|
|
133
|
-
function only(options?: TestOptions, fn?: TestFn): void
|
|
134
|
-
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>;
|
|
135
126
|
}
|
|
136
127
|
/**
|
|
137
128
|
* Shorthand for skipping a test, same as `test([name], { skip: true }[, fn])`.
|
|
@@ -205,10 +196,21 @@ declare module 'node:test' {
|
|
|
205
196
|
* incremented from the primary's `process.debugPort`.
|
|
206
197
|
*/
|
|
207
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[];
|
|
208
205
|
/**
|
|
209
206
|
* A function that accepts the TestsStream instance and can be used to setup listeners before any tests are run.
|
|
210
207
|
*/
|
|
211
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;
|
|
212
214
|
}
|
|
213
215
|
class Test extends AsyncResource {
|
|
214
216
|
concurrency: number;
|
|
@@ -227,53 +229,53 @@ declare module 'node:test' {
|
|
|
227
229
|
* @since v18.9.0
|
|
228
230
|
*/
|
|
229
231
|
interface TestsStream extends NodeJS.ReadableStream {
|
|
230
|
-
addListener(event:
|
|
231
|
-
addListener(event:
|
|
232
|
-
addListener(event:
|
|
233
|
-
addListener(event:
|
|
234
|
-
addListener(event:
|
|
235
|
-
addListener(event:
|
|
236
|
-
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;
|
|
237
239
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
238
|
-
emit(event:
|
|
239
|
-
emit(event:
|
|
240
|
-
emit(event:
|
|
241
|
-
emit(event:
|
|
242
|
-
emit(event:
|
|
243
|
-
emit(event:
|
|
244
|
-
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;
|
|
245
247
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
246
|
-
on(event:
|
|
247
|
-
on(event:
|
|
248
|
-
on(event:
|
|
249
|
-
on(event:
|
|
250
|
-
on(event:
|
|
251
|
-
on(event:
|
|
252
|
-
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;
|
|
253
255
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
254
|
-
once(event:
|
|
255
|
-
once(event:
|
|
256
|
-
once(event:
|
|
257
|
-
once(event:
|
|
258
|
-
once(event:
|
|
259
|
-
once(event:
|
|
260
|
-
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;
|
|
261
263
|
once(event: string, listener: (...args: any[]) => void): this;
|
|
262
|
-
prependListener(event:
|
|
263
|
-
prependListener(event:
|
|
264
|
-
prependListener(event:
|
|
265
|
-
prependListener(event:
|
|
266
|
-
prependListener(event:
|
|
267
|
-
prependListener(event:
|
|
268
|
-
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;
|
|
269
271
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
270
|
-
prependOnceListener(event:
|
|
271
|
-
prependOnceListener(event:
|
|
272
|
-
prependOnceListener(event:
|
|
273
|
-
prependOnceListener(event:
|
|
274
|
-
prependOnceListener(event:
|
|
275
|
-
prependOnceListener(event:
|
|
276
|
-
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;
|
|
277
279
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
278
280
|
}
|
|
279
281
|
|
|
@@ -554,7 +556,11 @@ declare module 'node:test' {
|
|
|
554
556
|
* @param options Optional configuration options for the mock function.
|
|
555
557
|
*/
|
|
556
558
|
fn<F extends Function = NoOpFunction>(original?: F, options?: MockFunctionOptions): Mock<F>;
|
|
557
|
-
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>;
|
|
558
564
|
|
|
559
565
|
/**
|
|
560
566
|
* This function is used to create a mock on an existing object method.
|
|
@@ -570,8 +576,7 @@ declare module 'node:test' {
|
|
|
570
576
|
object: MockedObject,
|
|
571
577
|
methodName: MethodName,
|
|
572
578
|
options?: MockFunctionOptions,
|
|
573
|
-
): MockedObject[MethodName] extends Function
|
|
574
|
-
? Mock<MockedObject[MethodName]>
|
|
579
|
+
): MockedObject[MethodName] extends Function ? Mock<MockedObject[MethodName]>
|
|
575
580
|
: never;
|
|
576
581
|
method<
|
|
577
582
|
MockedObject extends object,
|
|
@@ -582,8 +587,7 @@ declare module 'node:test' {
|
|
|
582
587
|
methodName: MethodName,
|
|
583
588
|
implementation: Implementation,
|
|
584
589
|
options?: MockFunctionOptions,
|
|
585
|
-
): MockedObject[MethodName] extends Function
|
|
586
|
-
? Mock<MockedObject[MethodName] | Implementation>
|
|
590
|
+
): MockedObject[MethodName] extends Function ? Mock<MockedObject[MethodName] | Implementation>
|
|
587
591
|
: never;
|
|
588
592
|
method<MockedObject extends object>(
|
|
589
593
|
object: MockedObject,
|
|
@@ -662,16 +666,12 @@ declare module 'node:test' {
|
|
|
662
666
|
|
|
663
667
|
interface MockFunctionCall<
|
|
664
668
|
F extends Function,
|
|
665
|
-
ReturnType = F extends (...args: any) => infer T
|
|
666
|
-
? T
|
|
667
|
-
:
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
? Y
|
|
672
|
-
: F extends abstract new (...args: infer Y) => any
|
|
673
|
-
? Y
|
|
674
|
-
: 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[],
|
|
675
675
|
> {
|
|
676
676
|
/**
|
|
677
677
|
* An array of the arguments passed to the mock function.
|
|
@@ -695,7 +695,7 @@ declare module 'node:test' {
|
|
|
695
695
|
* If the mocked function is a constructor, this field contains the class being constructed.
|
|
696
696
|
* Otherwise this will be `undefined`.
|
|
697
697
|
*/
|
|
698
|
-
target: F extends abstract new
|
|
698
|
+
target: F extends abstract new(...args: any) => any ? F : undefined;
|
|
699
699
|
/**
|
|
700
700
|
* The mocked function's `this` value.
|
|
701
701
|
*/
|
|
@@ -743,7 +743,7 @@ declare module 'node:test' {
|
|
|
743
743
|
restore(): void;
|
|
744
744
|
}
|
|
745
745
|
|
|
746
|
-
export {
|
|
746
|
+
export { after, afterEach, before, beforeEach, describe, it, mock, run, test, test as default };
|
|
747
747
|
}
|
|
748
748
|
|
|
749
749
|
interface DiagnosticData {
|
|
@@ -777,7 +777,7 @@ interface TestFail {
|
|
|
777
777
|
* The type of the test, used to denote whether this is a suite.
|
|
778
778
|
* @since 18.17.0
|
|
779
779
|
*/
|
|
780
|
-
type?:
|
|
780
|
+
type?: "suite";
|
|
781
781
|
};
|
|
782
782
|
/**
|
|
783
783
|
* The test name.
|
|
@@ -817,7 +817,7 @@ interface TestPass {
|
|
|
817
817
|
* The type of the test, used to denote whether this is a suite.
|
|
818
818
|
* @since 18.17.0
|
|
819
819
|
*/
|
|
820
|
-
type?:
|
|
820
|
+
type?: "suite";
|
|
821
821
|
};
|
|
822
822
|
/**
|
|
823
823
|
* The test name.
|
|
@@ -938,20 +938,20 @@ interface TestDequeue {
|
|
|
938
938
|
* @since v18.17.0
|
|
939
939
|
* @see [source](https://github.com/nodejs/node/blob/v18.17.0/lib/test/reporters.js)
|
|
940
940
|
*/
|
|
941
|
-
declare module
|
|
942
|
-
import { Transform } from
|
|
941
|
+
declare module "node:test/reporters" {
|
|
942
|
+
import { Transform } from "node:stream";
|
|
943
943
|
|
|
944
944
|
type TestEvent =
|
|
945
|
-
| { type:
|
|
946
|
-
| { type:
|
|
947
|
-
| { type:
|
|
948
|
-
| { type:
|
|
949
|
-
| { type:
|
|
950
|
-
| { type:
|
|
951
|
-
| { type:
|
|
952
|
-
| { type:
|
|
953
|
-
| { type:
|
|
954
|
-
| { 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" };
|
|
955
955
|
type TestEventGenerator = AsyncGenerator<TestEvent, void>;
|
|
956
956
|
|
|
957
957
|
/**
|
|
@@ -959,7 +959,7 @@ declare module 'node:test/reporters' {
|
|
|
959
959
|
* where each passing test is represented by a `.`,
|
|
960
960
|
* and each failing test is represented by a `X`.
|
|
961
961
|
*/
|
|
962
|
-
function dot(source: TestEventGenerator): AsyncGenerator<
|
|
962
|
+
function dot(source: TestEventGenerator): AsyncGenerator<"\n" | "." | "X", void>;
|
|
963
963
|
/**
|
|
964
964
|
* The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format.
|
|
965
965
|
*/
|
|
@@ -970,5 +970,5 @@ declare module 'node:test/reporters' {
|
|
|
970
970
|
class Spec extends Transform {
|
|
971
971
|
constructor();
|
|
972
972
|
}
|
|
973
|
-
export { dot,
|
|
973
|
+
export { dot, Spec as spec, tap, TestEvent };
|
|
974
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,6 +69,11 @@ 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
|
/**
|
|
@@ -69,7 +83,11 @@ declare module 'timers' {
|
|
|
69
83
|
* If `callback` is not a function, a [TypeError](https://nodejs.org/api/errors.html#class-typeerror) will be thrown.
|
|
70
84
|
* @since v0.0.1
|
|
71
85
|
*/
|
|
72
|
-
function setTimeout<TArgs extends any[]>(
|
|
86
|
+
function setTimeout<TArgs extends any[]>(
|
|
87
|
+
callback: (...args: TArgs) => void,
|
|
88
|
+
ms?: number,
|
|
89
|
+
...args: TArgs
|
|
90
|
+
): NodeJS.Timeout;
|
|
73
91
|
// util.promisify no rest args compability
|
|
74
92
|
// tslint:disable-next-line void-return
|
|
75
93
|
function setTimeout(callback: (args: void) => void, ms?: number): NodeJS.Timeout;
|
|
@@ -77,15 +95,22 @@ declare module 'timers' {
|
|
|
77
95
|
const __promisify__: typeof setTimeoutPromise;
|
|
78
96
|
}
|
|
79
97
|
function clearTimeout(timeoutId: NodeJS.Timeout | string | number | undefined): void;
|
|
80
|
-
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;
|
|
81
103
|
// util.promisify no rest args compability
|
|
82
104
|
// tslint:disable-next-line void-return
|
|
83
|
-
function setInterval(callback: (args: void) => void, ms?: number): NodeJS.
|
|
105
|
+
function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timeout;
|
|
84
106
|
namespace setInterval {
|
|
85
107
|
const __promisify__: typeof setIntervalPromise;
|
|
86
108
|
}
|
|
87
109
|
function clearInterval(intervalId: NodeJS.Timeout | string | number | undefined): void;
|
|
88
|
-
function setImmediate<TArgs extends any[]>(
|
|
110
|
+
function setImmediate<TArgs extends any[]>(
|
|
111
|
+
callback: (...args: TArgs) => void,
|
|
112
|
+
...args: TArgs
|
|
113
|
+
): NodeJS.Immediate;
|
|
89
114
|
// util.promisify no rest args compability
|
|
90
115
|
// tslint:disable-next-line void-return
|
|
91
116
|
function setImmediate(callback: (args: void) => void): NodeJS.Immediate;
|
|
@@ -96,6 +121,6 @@ declare module 'timers' {
|
|
|
96
121
|
function queueMicrotask(callback: () => void): void;
|
|
97
122
|
}
|
|
98
123
|
}
|
|
99
|
-
declare module
|
|
100
|
-
export * from
|
|
124
|
+
declare module "node:timers" {
|
|
125
|
+
export * from "timers";
|
|
101
126
|
}
|