@types/node 18.16.20 → 18.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {node v18.16 → node v18.17}/README.md +1 -1
- {node v18.16/ts4.8 → node v18.17}/dns.d.ts +8 -0
- {node v18.16 → node v18.17}/events.d.ts +29 -0
- {node v18.16 → node v18.17}/fs/promises.d.ts +12 -1
- {node v18.16 → node v18.17}/fs.d.ts +16 -0
- {node v18.16 → node v18.17}/http.d.ts +7 -0
- {node v18.16 → node v18.17}/index.d.ts +1 -1
- {node v18.16 → node v18.17}/package.json +2 -2
- {node v18.16 → node v18.17}/stream.d.ts +18 -0
- {node v18.16 → node v18.17}/test.d.ts +235 -116
- {node v18.16 → node v18.17/ts4.8}/dns.d.ts +8 -0
- {node v18.16 → node v18.17}/ts4.8/events.d.ts +29 -0
- {node v18.16 → node v18.17}/ts4.8/fs/promises.d.ts +33 -1
- {node v18.16 → node v18.17}/ts4.8/fs.d.ts +118 -1
- {node v18.16 → node v18.17}/ts4.8/http.d.ts +73 -3
- {node v18.16 → node v18.17}/ts4.8/stream.d.ts +21 -3
- {node v18.16 → node v18.17}/ts4.8/test.d.ts +235 -117
- {node v18.16 → node v18.17}/ts4.8/url.d.ts +14 -0
- {node v18.16 → node v18.17}/url.d.ts +14 -0
- {node v18.16 → node v18.17}/LICENSE +0 -0
- {node v18.16 → node v18.17}/assert/strict.d.ts +0 -0
- {node v18.16 → node v18.17}/assert.d.ts +0 -0
- {node v18.16 → node v18.17}/async_hooks.d.ts +0 -0
- {node v18.16 → node v18.17}/buffer.d.ts +0 -0
- {node v18.16 → node v18.17}/child_process.d.ts +0 -0
- {node v18.16 → node v18.17}/cluster.d.ts +0 -0
- {node v18.16 → node v18.17}/console.d.ts +0 -0
- {node v18.16 → node v18.17}/constants.d.ts +0 -0
- {node v18.16 → node v18.17}/crypto.d.ts +0 -0
- {node v18.16 → node v18.17}/dgram.d.ts +0 -0
- {node v18.16 → node v18.17}/diagnostics_channel.d.ts +0 -0
- {node v18.16 → node v18.17}/dns/promises.d.ts +0 -0
- {node v18.16 → node v18.17}/dom-events.d.ts +0 -0
- {node v18.16 → node v18.17}/domain.d.ts +0 -0
- {node v18.16 → node v18.17}/globals.d.ts +0 -0
- {node v18.16 → node v18.17}/globals.global.d.ts +0 -0
- {node v18.16 → node v18.17}/http2.d.ts +0 -0
- {node v18.16 → node v18.17}/https.d.ts +0 -0
- {node v18.16 → node v18.17}/inspector.d.ts +0 -0
- {node v18.16 → node v18.17}/module.d.ts +0 -0
- {node v18.16 → node v18.17}/net.d.ts +0 -0
- {node v18.16 → node v18.17}/os.d.ts +0 -0
- {node v18.16 → node v18.17}/path.d.ts +0 -0
- {node v18.16 → node v18.17}/perf_hooks.d.ts +0 -0
- {node v18.16 → node v18.17}/process.d.ts +0 -0
- {node v18.16 → node v18.17}/punycode.d.ts +0 -0
- {node v18.16 → node v18.17}/querystring.d.ts +0 -0
- {node v18.16 → node v18.17}/readline/promises.d.ts +0 -0
- {node v18.16 → node v18.17}/readline.d.ts +0 -0
- {node v18.16 → node v18.17}/repl.d.ts +0 -0
- {node v18.16 → node v18.17}/stream/consumers.d.ts +0 -0
- {node v18.16 → node v18.17}/stream/promises.d.ts +0 -0
- {node v18.16 → node v18.17}/stream/web.d.ts +0 -0
- {node v18.16 → node v18.17}/string_decoder.d.ts +0 -0
- {node v18.16 → node v18.17}/timers/promises.d.ts +0 -0
- {node v18.16 → node v18.17}/timers.d.ts +0 -0
- {node v18.16 → node v18.17}/tls.d.ts +0 -0
- {node v18.16 → node v18.17}/trace_events.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/assert/strict.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/assert.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/async_hooks.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/buffer.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/child_process.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/cluster.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/console.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/constants.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/crypto.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/dgram.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/diagnostics_channel.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/dns/promises.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/dom-events.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/domain.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/globals.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/globals.global.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/http2.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/https.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/index.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/inspector.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/module.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/net.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/os.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/path.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/perf_hooks.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/process.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/punycode.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/querystring.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/readline/promises.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/readline.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/repl.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/stream/consumers.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/stream/promises.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/stream/web.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/string_decoder.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/timers/promises.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/timers.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/tls.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/trace_events.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/tty.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/util.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/v8.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/vm.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/wasi.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/worker_threads.d.ts +0 -0
- {node v18.16 → node v18.17}/ts4.8/zlib.d.ts +0 -0
- {node v18.16 → node v18.17}/tty.d.ts +0 -0
- {node v18.16 → node v18.17}/util.d.ts +0 -0
- {node v18.16 → node v18.17}/v8.d.ts +0 -0
- {node v18.16 → node v18.17}/vm.d.ts +0 -0
- {node v18.16 → node v18.17}/wasi.d.ts +0 -0
- {node v18.16 → node v18.17}/worker_threads.d.ts +0 -0
- {node v18.16 → node v18.17}/zlib.d.ts +0 -0
|
@@ -58,7 +58,10 @@ declare module 'node:test' {
|
|
|
58
58
|
it,
|
|
59
59
|
run,
|
|
60
60
|
mock,
|
|
61
|
-
test
|
|
61
|
+
test,
|
|
62
|
+
skip,
|
|
63
|
+
todo,
|
|
64
|
+
only
|
|
62
65
|
};
|
|
63
66
|
}
|
|
64
67
|
/**
|
|
@@ -129,6 +132,30 @@ declare module 'node:test' {
|
|
|
129
132
|
function only(options?: TestOptions, fn?: TestFn): void;
|
|
130
133
|
function only(fn?: TestFn): void;
|
|
131
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Shorthand for skipping a test, same as `test([name], { skip: true }[, fn])`.
|
|
137
|
+
* @since v18.17.0
|
|
138
|
+
*/
|
|
139
|
+
function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
140
|
+
function skip(name?: string, fn?: TestFn): Promise<void>;
|
|
141
|
+
function skip(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
142
|
+
function skip(fn?: TestFn): Promise<void>;
|
|
143
|
+
/**
|
|
144
|
+
* Shorthand for marking a test as `TODO`, same as `test([name], { todo: true }[, fn])`.
|
|
145
|
+
* @since v18.17.0
|
|
146
|
+
*/
|
|
147
|
+
function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
148
|
+
function todo(name?: string, fn?: TestFn): Promise<void>;
|
|
149
|
+
function todo(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
150
|
+
function todo(fn?: TestFn): Promise<void>;
|
|
151
|
+
/**
|
|
152
|
+
* Shorthand for marking a test as `only`, same as `test([name], { only: true }[, fn])`.
|
|
153
|
+
* @since v18.17.0
|
|
154
|
+
*/
|
|
155
|
+
function only(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
156
|
+
function only(name?: string, fn?: TestFn): Promise<void>;
|
|
157
|
+
function only(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
158
|
+
function only(fn?: TestFn): Promise<void>;
|
|
132
159
|
|
|
133
160
|
/**
|
|
134
161
|
* The type of a function under test. The first argument to this function is a
|
|
@@ -192,160 +219,66 @@ declare module 'node:test' {
|
|
|
192
219
|
addListener(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
193
220
|
addListener(event: 'test:plan', listener: (data: TestPlan) => void): this;
|
|
194
221
|
addListener(event: 'test:start', listener: (data: TestStart) => void): this;
|
|
222
|
+
addListener(event: 'test:stderr', listener: (data: TestStderr) => void): this;
|
|
223
|
+
addListener(event: 'test:stdout', listener: (data: TestStdout) => void): this;
|
|
195
224
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
196
225
|
emit(event: 'test:diagnostic', data: DiagnosticData): boolean;
|
|
197
226
|
emit(event: 'test:fail', data: TestFail): boolean;
|
|
198
227
|
emit(event: 'test:pass', data: TestPass): boolean;
|
|
199
228
|
emit(event: 'test:plan', data: TestPlan): boolean;
|
|
200
229
|
emit(event: 'test:start', data: TestStart): boolean;
|
|
230
|
+
emit(event: 'test:stderr', data: TestStderr): boolean;
|
|
231
|
+
emit(event: 'test:stdout', data: TestStdout): boolean;
|
|
201
232
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
202
233
|
on(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this;
|
|
203
234
|
on(event: 'test:fail', listener: (data: TestFail) => void): this;
|
|
204
235
|
on(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
205
236
|
on(event: 'test:plan', listener: (data: TestPlan) => void): this;
|
|
206
237
|
on(event: 'test:start', listener: (data: TestStart) => void): this;
|
|
238
|
+
on(event: 'test:stderr', listener: (data: TestStderr) => void): this;
|
|
239
|
+
on(event: 'test:stdout', listener: (data: TestStdout) => void): this;
|
|
207
240
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
208
241
|
once(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this;
|
|
209
242
|
once(event: 'test:fail', listener: (data: TestFail) => void): this;
|
|
210
243
|
once(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
211
244
|
once(event: 'test:plan', listener: (data: TestPlan) => void): this;
|
|
212
245
|
once(event: 'test:start', listener: (data: TestStart) => void): this;
|
|
246
|
+
once(event: 'test:stderr', listener: (data: TestStderr) => void): this;
|
|
247
|
+
once(event: 'test:stdout', listener: (data: TestStdout) => void): this;
|
|
213
248
|
once(event: string, listener: (...args: any[]) => void): this;
|
|
214
249
|
prependListener(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this;
|
|
215
250
|
prependListener(event: 'test:fail', listener: (data: TestFail) => void): this;
|
|
216
251
|
prependListener(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
217
252
|
prependListener(event: 'test:plan', listener: (data: TestPlan) => void): this;
|
|
218
253
|
prependListener(event: 'test:start', listener: (data: TestStart) => void): this;
|
|
254
|
+
prependListener(event: 'test:stderr', listener: (data: TestStderr) => void): this;
|
|
255
|
+
prependListener(event: 'test:stdout', listener: (data: TestStdout) => void): this;
|
|
219
256
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
220
257
|
prependOnceListener(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this;
|
|
221
258
|
prependOnceListener(event: 'test:fail', listener: (data: TestFail) => void): this;
|
|
222
259
|
prependOnceListener(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
223
260
|
prependOnceListener(event: 'test:plan', listener: (data: TestPlan) => void): this;
|
|
224
261
|
prependOnceListener(event: 'test:start', listener: (data: TestStart) => void): this;
|
|
262
|
+
prependOnceListener(event: 'test:stderr', listener: (data: TestStderr) => void): this;
|
|
263
|
+
prependOnceListener(event: 'test:stdout', listener: (data: TestStdout) => void): this;
|
|
225
264
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
226
265
|
}
|
|
227
266
|
|
|
228
|
-
interface DiagnosticData {
|
|
229
|
-
/**
|
|
230
|
-
* The diagnostic message.
|
|
231
|
-
*/
|
|
232
|
-
message: string;
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* The nesting level of the test.
|
|
236
|
-
*/
|
|
237
|
-
nesting: number;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
interface TestFail {
|
|
241
|
-
/**
|
|
242
|
-
* Additional execution metadata.
|
|
243
|
-
*/
|
|
244
|
-
details: {
|
|
245
|
-
/**
|
|
246
|
-
* The duration of the test in milliseconds.
|
|
247
|
-
*/
|
|
248
|
-
duration: number;
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* The error thrown by the test.
|
|
252
|
-
*/
|
|
253
|
-
error: Error;
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* The test name.
|
|
258
|
-
*/
|
|
259
|
-
name: string;
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* The nesting level of the test.
|
|
263
|
-
*/
|
|
264
|
-
nesting: number;
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* The ordinal number of the test.
|
|
268
|
-
*/
|
|
269
|
-
testNumber: number;
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Present if `context.todo` is called.
|
|
273
|
-
*/
|
|
274
|
-
todo?: string | boolean;
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Present if `context.skip` is called.
|
|
278
|
-
*/
|
|
279
|
-
skip?: string | boolean;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
interface TestPass {
|
|
283
|
-
/**
|
|
284
|
-
* Additional execution metadata.
|
|
285
|
-
*/
|
|
286
|
-
details: {
|
|
287
|
-
/**
|
|
288
|
-
* The duration of the test in milliseconds.
|
|
289
|
-
*/
|
|
290
|
-
duration: number;
|
|
291
|
-
};
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* The test name.
|
|
295
|
-
*/
|
|
296
|
-
name: string;
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* The nesting level of the test.
|
|
300
|
-
*/
|
|
301
|
-
nesting: number;
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* The ordinal number of the test.
|
|
305
|
-
*/
|
|
306
|
-
testNumber: number;
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* Present if `context.todo` is called.
|
|
310
|
-
*/
|
|
311
|
-
todo?: string | boolean;
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* Present if `context.skip` is called.
|
|
315
|
-
*/
|
|
316
|
-
skip?: string | boolean;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
interface TestPlan {
|
|
320
|
-
/**
|
|
321
|
-
* The nesting level of the test.
|
|
322
|
-
*/
|
|
323
|
-
nesting: number;
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* The number of subtests that have ran.
|
|
327
|
-
*/
|
|
328
|
-
count: number;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
interface TestStart {
|
|
332
|
-
/**
|
|
333
|
-
* The test name.
|
|
334
|
-
*/
|
|
335
|
-
name: string;
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* The nesting level of the test.
|
|
339
|
-
*/
|
|
340
|
-
nesting: number;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
267
|
/**
|
|
344
268
|
* An instance of `TestContext` is passed to each test function in order to interact with the
|
|
345
269
|
* test runner. However, the `TestContext` constructor is not exposed as part of the API.
|
|
346
270
|
* @since v18.0.0
|
|
347
271
|
*/
|
|
348
272
|
interface TestContext {
|
|
273
|
+
/**
|
|
274
|
+
* This function is used to create a hook running before subtest of the current test.
|
|
275
|
+
* @param fn The hook function. If the hook uses callbacks, the callback function is passed as
|
|
276
|
+
* the second argument. Default: A no-op function.
|
|
277
|
+
* @param options Configuration options for the hook.
|
|
278
|
+
* @since v18.17.0
|
|
279
|
+
*/
|
|
280
|
+
before: typeof before;
|
|
281
|
+
|
|
349
282
|
/**
|
|
350
283
|
* This function is used to create a hook running before each subtest of the current test.
|
|
351
284
|
* @param fn The hook function. If the hook uses callbacks, the callback function is passed as
|
|
@@ -781,3 +714,189 @@ declare module 'node:test' {
|
|
|
781
714
|
|
|
782
715
|
export { test as default, run, test, describe, it, before, after, beforeEach, afterEach, mock };
|
|
783
716
|
}
|
|
717
|
+
|
|
718
|
+
interface DiagnosticData {
|
|
719
|
+
/**
|
|
720
|
+
* The diagnostic message.
|
|
721
|
+
*/
|
|
722
|
+
message: string;
|
|
723
|
+
/**
|
|
724
|
+
* The nesting level of the test.
|
|
725
|
+
*/
|
|
726
|
+
nesting: number;
|
|
727
|
+
/**
|
|
728
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
729
|
+
*/
|
|
730
|
+
file?: string;
|
|
731
|
+
}
|
|
732
|
+
interface TestFail {
|
|
733
|
+
/**
|
|
734
|
+
* Additional execution metadata.
|
|
735
|
+
*/
|
|
736
|
+
details: {
|
|
737
|
+
/**
|
|
738
|
+
* The duration of the test in milliseconds.
|
|
739
|
+
*/
|
|
740
|
+
duration: number;
|
|
741
|
+
/**
|
|
742
|
+
* The error thrown by the test.
|
|
743
|
+
*/
|
|
744
|
+
error: Error;
|
|
745
|
+
};
|
|
746
|
+
/**
|
|
747
|
+
* The test name.
|
|
748
|
+
*/
|
|
749
|
+
name: string;
|
|
750
|
+
/**
|
|
751
|
+
* The nesting level of the test.
|
|
752
|
+
*/
|
|
753
|
+
nesting: number;
|
|
754
|
+
/**
|
|
755
|
+
* The ordinal number of the test.
|
|
756
|
+
*/
|
|
757
|
+
testNumber: number;
|
|
758
|
+
/**
|
|
759
|
+
* Present if `context.todo` is called.
|
|
760
|
+
*/
|
|
761
|
+
todo?: string | boolean;
|
|
762
|
+
/**
|
|
763
|
+
* Present if `context.skip` is called.
|
|
764
|
+
*/
|
|
765
|
+
skip?: string | boolean;
|
|
766
|
+
/**
|
|
767
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
768
|
+
*/
|
|
769
|
+
file?: string;
|
|
770
|
+
}
|
|
771
|
+
interface TestPass {
|
|
772
|
+
/**
|
|
773
|
+
* Additional execution metadata.
|
|
774
|
+
*/
|
|
775
|
+
details: {
|
|
776
|
+
/**
|
|
777
|
+
* The duration of the test in milliseconds.
|
|
778
|
+
*/
|
|
779
|
+
duration: number;
|
|
780
|
+
};
|
|
781
|
+
/**
|
|
782
|
+
* The test name.
|
|
783
|
+
*/
|
|
784
|
+
name: string;
|
|
785
|
+
/**
|
|
786
|
+
* The nesting level of the test.
|
|
787
|
+
*/
|
|
788
|
+
nesting: number;
|
|
789
|
+
/**
|
|
790
|
+
* The ordinal number of the test.
|
|
791
|
+
*/
|
|
792
|
+
testNumber: number;
|
|
793
|
+
/**
|
|
794
|
+
* Present if `context.todo` is called.
|
|
795
|
+
*/
|
|
796
|
+
todo?: string | boolean;
|
|
797
|
+
/**
|
|
798
|
+
* Present if `context.skip` is called.
|
|
799
|
+
*/
|
|
800
|
+
skip?: string | boolean;
|
|
801
|
+
/**
|
|
802
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
803
|
+
*/
|
|
804
|
+
file?: string;
|
|
805
|
+
}
|
|
806
|
+
interface TestPlan {
|
|
807
|
+
/**
|
|
808
|
+
* The nesting level of the test.
|
|
809
|
+
*/
|
|
810
|
+
nesting: number;
|
|
811
|
+
/**
|
|
812
|
+
* The number of subtests that have ran.
|
|
813
|
+
*/
|
|
814
|
+
count: number;
|
|
815
|
+
/**
|
|
816
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
817
|
+
*/
|
|
818
|
+
file?: string;
|
|
819
|
+
}
|
|
820
|
+
interface TestStart {
|
|
821
|
+
/**
|
|
822
|
+
* The test name.
|
|
823
|
+
*/
|
|
824
|
+
name: string;
|
|
825
|
+
/**
|
|
826
|
+
* The nesting level of the test.
|
|
827
|
+
*/
|
|
828
|
+
nesting: number;
|
|
829
|
+
/**
|
|
830
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
831
|
+
*/
|
|
832
|
+
file?: string;
|
|
833
|
+
}
|
|
834
|
+
interface TestStderr {
|
|
835
|
+
/**
|
|
836
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
837
|
+
*/
|
|
838
|
+
file?: string;
|
|
839
|
+
/**
|
|
840
|
+
* The message written to `stderr`
|
|
841
|
+
*/
|
|
842
|
+
message: string;
|
|
843
|
+
}
|
|
844
|
+
interface TestStdout {
|
|
845
|
+
/**
|
|
846
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
847
|
+
*/
|
|
848
|
+
file?: string;
|
|
849
|
+
/**
|
|
850
|
+
* The message written to `stdout`
|
|
851
|
+
*/
|
|
852
|
+
message: string;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* The `node:test/reporters` module exposes the builtin-reporters for `node:test`.
|
|
857
|
+
* To access it:
|
|
858
|
+
*
|
|
859
|
+
* ```js
|
|
860
|
+
* import test from 'node:test/reporters';
|
|
861
|
+
* ```
|
|
862
|
+
*
|
|
863
|
+
* This module is only available under the `node:` scheme. The following will not
|
|
864
|
+
* work:
|
|
865
|
+
*
|
|
866
|
+
* ```js
|
|
867
|
+
* import test from 'test/reporters';
|
|
868
|
+
* ```
|
|
869
|
+
* @since v18.17.0
|
|
870
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.17.0/lib/test/reporters.js)
|
|
871
|
+
*/
|
|
872
|
+
declare module 'node:test/reporters' {
|
|
873
|
+
import { Transform } from 'node:stream';
|
|
874
|
+
|
|
875
|
+
type TestEvent =
|
|
876
|
+
| { type: 'test:diagnostic', data: DiagnosticData }
|
|
877
|
+
| { type: 'test:fail', data: TestFail }
|
|
878
|
+
| { type: 'test:pass', data: TestPass }
|
|
879
|
+
| { type: 'test:plan', data: TestPlan }
|
|
880
|
+
| { type: 'test:start', data: TestStart }
|
|
881
|
+
| { type: 'test:stderr', data: TestStderr }
|
|
882
|
+
| { type: 'test:stdout', data: TestStdout };
|
|
883
|
+
type TestEventGenerator = AsyncGenerator<TestEvent, void>;
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* The `dot` reporter outputs the test results in a compact format,
|
|
887
|
+
* where each passing test is represented by a `.`,
|
|
888
|
+
* and each failing test is represented by a `X`.
|
|
889
|
+
*/
|
|
890
|
+
function dot(source: TestEventGenerator): AsyncGenerator<'\n' | '.' | 'X', void>;
|
|
891
|
+
/**
|
|
892
|
+
* The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format.
|
|
893
|
+
*/
|
|
894
|
+
function tap(source: TestEventGenerator): AsyncGenerator<string, void>;
|
|
895
|
+
/**
|
|
896
|
+
* The `spec` reporter outputs the test results in a human-readable format.
|
|
897
|
+
*/
|
|
898
|
+
class Spec extends Transform {
|
|
899
|
+
constructor();
|
|
900
|
+
}
|
|
901
|
+
export { dot, tap, Spec as spec };
|
|
902
|
+
}
|
|
@@ -484,6 +484,14 @@ declare module 'dns' {
|
|
|
484
484
|
* @since v0.1.16
|
|
485
485
|
*/
|
|
486
486
|
export function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void;
|
|
487
|
+
/**
|
|
488
|
+
* Get the default value for `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be:
|
|
489
|
+
*
|
|
490
|
+
* * `ipv4first`: for `verbatim` defaulting to `false`.
|
|
491
|
+
* * `verbatim`: for `verbatim` defaulting to `true`.
|
|
492
|
+
* @since v18.17.0
|
|
493
|
+
*/
|
|
494
|
+
export function getDefaultResultOrder(): 'ipv4first' | 'verbatim';
|
|
487
495
|
/**
|
|
488
496
|
* Sets the IP address and port of servers to be used when performing DNS
|
|
489
497
|
* resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
|
|
@@ -297,6 +297,35 @@ declare module 'events' {
|
|
|
297
297
|
* @since v15.2.0, v14.17.0
|
|
298
298
|
*/
|
|
299
299
|
static getEventListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
|
|
300
|
+
/**
|
|
301
|
+
* Returns the currently set max amount of listeners.
|
|
302
|
+
*
|
|
303
|
+
* For `EventEmitter`s this behaves exactly the same as calling `.getMaxListeners` on
|
|
304
|
+
* the emitter.
|
|
305
|
+
*
|
|
306
|
+
* For `EventTarget`s this is the only way to get the max event listeners for the
|
|
307
|
+
* event target. If the number of event handlers on a single EventTarget exceeds
|
|
308
|
+
* the max set, the EventTarget will print a warning.
|
|
309
|
+
*
|
|
310
|
+
* ```js
|
|
311
|
+
* import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
|
|
312
|
+
*
|
|
313
|
+
* {
|
|
314
|
+
* const ee = new EventEmitter();
|
|
315
|
+
* console.log(getMaxListeners(ee)); // 10
|
|
316
|
+
* setMaxListeners(11, ee);
|
|
317
|
+
* console.log(getMaxListeners(ee)); // 11
|
|
318
|
+
* }
|
|
319
|
+
* {
|
|
320
|
+
* const et = new EventTarget();
|
|
321
|
+
* console.log(getMaxListeners(et)); // 10
|
|
322
|
+
* setMaxListeners(11, et);
|
|
323
|
+
* console.log(getMaxListeners(et)); // 11
|
|
324
|
+
* }
|
|
325
|
+
* ```
|
|
326
|
+
* @since v18.17.0
|
|
327
|
+
*/
|
|
328
|
+
static getMaxListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter): number;
|
|
300
329
|
/**
|
|
301
330
|
* ```js
|
|
302
331
|
* const {
|
|
@@ -14,6 +14,7 @@ declare module 'fs/promises' {
|
|
|
14
14
|
import { ReadableStream } from 'node:stream/web';
|
|
15
15
|
import {
|
|
16
16
|
BigIntStats,
|
|
17
|
+
BigIntStatsFs,
|
|
17
18
|
BufferEncodingOption,
|
|
18
19
|
constants as fsConstants,
|
|
19
20
|
CopyOptions,
|
|
@@ -30,7 +31,9 @@ declare module 'fs/promises' {
|
|
|
30
31
|
RmDirOptions,
|
|
31
32
|
RmOptions,
|
|
32
33
|
StatOptions,
|
|
34
|
+
StatFsOptions,
|
|
33
35
|
Stats,
|
|
36
|
+
StatsFs,
|
|
34
37
|
TimeLike,
|
|
35
38
|
WatchEventType,
|
|
36
39
|
WatchOptions,
|
|
@@ -80,6 +83,13 @@ declare module 'fs/promises' {
|
|
|
80
83
|
emitClose?: boolean | undefined;
|
|
81
84
|
start?: number | undefined;
|
|
82
85
|
}
|
|
86
|
+
interface ReadableWebStreamOptions {
|
|
87
|
+
/**
|
|
88
|
+
* Whether to open a normal or a `'bytes'` stream.
|
|
89
|
+
* @since v18.17.0
|
|
90
|
+
*/
|
|
91
|
+
type?: 'bytes' | undefined;
|
|
92
|
+
}
|
|
83
93
|
// TODO: Add `EventEmitter` close
|
|
84
94
|
interface FileHandle {
|
|
85
95
|
/**
|
|
@@ -236,7 +246,7 @@ declare module 'fs/promises' {
|
|
|
236
246
|
* @since v17.0.0
|
|
237
247
|
* @experimental
|
|
238
248
|
*/
|
|
239
|
-
readableWebStream(): ReadableStream;
|
|
249
|
+
readableWebStream(options?: ReadableWebStreamOptions): ReadableStream;
|
|
240
250
|
/**
|
|
241
251
|
* Asynchronously reads the entire contents of a file.
|
|
242
252
|
*
|
|
@@ -630,6 +640,7 @@ declare module 'fs/promises' {
|
|
|
630
640
|
options?:
|
|
631
641
|
| (ObjectEncodingOptions & {
|
|
632
642
|
withFileTypes?: false | undefined;
|
|
643
|
+
recursive?: boolean | undefined;
|
|
633
644
|
})
|
|
634
645
|
| BufferEncoding
|
|
635
646
|
| null
|
|
@@ -645,6 +656,7 @@ declare module 'fs/promises' {
|
|
|
645
656
|
| {
|
|
646
657
|
encoding: 'buffer';
|
|
647
658
|
withFileTypes?: false | undefined;
|
|
659
|
+
recursive?: boolean | undefined;
|
|
648
660
|
}
|
|
649
661
|
| 'buffer'
|
|
650
662
|
): Promise<Buffer[]>;
|
|
@@ -658,6 +670,7 @@ declare module 'fs/promises' {
|
|
|
658
670
|
options?:
|
|
659
671
|
| (ObjectEncodingOptions & {
|
|
660
672
|
withFileTypes?: false | undefined;
|
|
673
|
+
recursive?: boolean | undefined;
|
|
661
674
|
})
|
|
662
675
|
| BufferEncoding
|
|
663
676
|
| null
|
|
@@ -671,6 +684,7 @@ declare module 'fs/promises' {
|
|
|
671
684
|
path: PathLike,
|
|
672
685
|
options: ObjectEncodingOptions & {
|
|
673
686
|
withFileTypes: true;
|
|
687
|
+
recursive?: boolean | undefined;
|
|
674
688
|
}
|
|
675
689
|
): Promise<Dirent[]>;
|
|
676
690
|
/**
|
|
@@ -745,6 +759,24 @@ declare module 'fs/promises' {
|
|
|
745
759
|
}
|
|
746
760
|
): Promise<BigIntStats>;
|
|
747
761
|
function stat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats>;
|
|
762
|
+
/**
|
|
763
|
+
* @since v18.15.0
|
|
764
|
+
* @return Fulfills with an {fs.StatFs} for the file system.
|
|
765
|
+
*/
|
|
766
|
+
function statfs(
|
|
767
|
+
path: PathLike,
|
|
768
|
+
opts?: StatFsOptions & {
|
|
769
|
+
bigint?: false | undefined;
|
|
770
|
+
}
|
|
771
|
+
): Promise<StatsFs>;
|
|
772
|
+
function statfs(
|
|
773
|
+
path: PathLike,
|
|
774
|
+
opts: StatFsOptions & {
|
|
775
|
+
bigint: true;
|
|
776
|
+
}
|
|
777
|
+
): Promise<BigIntStatsFs>;
|
|
778
|
+
function statfs(path: PathLike, opts?: StatFsOptions): Promise<StatsFs | BigIntStatsFs>;
|
|
779
|
+
|
|
748
780
|
/**
|
|
749
781
|
* Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail.
|
|
750
782
|
* @since v10.0.0
|