@types/node 18.16.20 → 18.17.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.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 +14 -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 +17 -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
|
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (https://nodejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v18.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Sat, 22 Jul 2023 12:32:51 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
|
|
14
14
|
|
|
@@ -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 {
|
|
@@ -83,6 +83,13 @@ declare module 'fs/promises' {
|
|
|
83
83
|
emitClose?: boolean | undefined;
|
|
84
84
|
start?: number | undefined;
|
|
85
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
|
+
}
|
|
86
93
|
// TODO: Add `EventEmitter` close
|
|
87
94
|
interface FileHandle {
|
|
88
95
|
/**
|
|
@@ -239,7 +246,7 @@ declare module 'fs/promises' {
|
|
|
239
246
|
* @since v17.0.0
|
|
240
247
|
* @experimental
|
|
241
248
|
*/
|
|
242
|
-
readableWebStream(): ReadableStream;
|
|
249
|
+
readableWebStream(options?: ReadableWebStreamOptions): ReadableStream;
|
|
243
250
|
/**
|
|
244
251
|
* Asynchronously reads the entire contents of a file.
|
|
245
252
|
*
|
|
@@ -633,6 +640,7 @@ declare module 'fs/promises' {
|
|
|
633
640
|
options?:
|
|
634
641
|
| (ObjectEncodingOptions & {
|
|
635
642
|
withFileTypes?: false | undefined;
|
|
643
|
+
recursive?: boolean | undefined;
|
|
636
644
|
})
|
|
637
645
|
| BufferEncoding
|
|
638
646
|
| null
|
|
@@ -648,6 +656,7 @@ declare module 'fs/promises' {
|
|
|
648
656
|
| {
|
|
649
657
|
encoding: 'buffer';
|
|
650
658
|
withFileTypes?: false | undefined;
|
|
659
|
+
recursive?: boolean | undefined;
|
|
651
660
|
}
|
|
652
661
|
| 'buffer'
|
|
653
662
|
): Promise<Buffer[]>;
|
|
@@ -661,6 +670,7 @@ declare module 'fs/promises' {
|
|
|
661
670
|
options?:
|
|
662
671
|
| (ObjectEncodingOptions & {
|
|
663
672
|
withFileTypes?: false | undefined;
|
|
673
|
+
recursive?: boolean | undefined;
|
|
664
674
|
})
|
|
665
675
|
| BufferEncoding
|
|
666
676
|
| null
|
|
@@ -674,6 +684,7 @@ declare module 'fs/promises' {
|
|
|
674
684
|
path: PathLike,
|
|
675
685
|
options: ObjectEncodingOptions & {
|
|
676
686
|
withFileTypes: true;
|
|
687
|
+
recursive?: boolean | undefined;
|
|
677
688
|
}
|
|
678
689
|
): Promise<Dirent[]>;
|
|
679
690
|
/**
|
|
@@ -1881,6 +1881,7 @@ declare module 'fs' {
|
|
|
1881
1881
|
| {
|
|
1882
1882
|
encoding: BufferEncoding | null;
|
|
1883
1883
|
withFileTypes?: false | undefined;
|
|
1884
|
+
recursive?: boolean | undefined;
|
|
1884
1885
|
}
|
|
1885
1886
|
| BufferEncoding
|
|
1886
1887
|
| undefined
|
|
@@ -1898,6 +1899,7 @@ declare module 'fs' {
|
|
|
1898
1899
|
| {
|
|
1899
1900
|
encoding: 'buffer';
|
|
1900
1901
|
withFileTypes?: false | undefined;
|
|
1902
|
+
recursive?: boolean | undefined;
|
|
1901
1903
|
}
|
|
1902
1904
|
| 'buffer',
|
|
1903
1905
|
callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void
|
|
@@ -1912,6 +1914,7 @@ declare module 'fs' {
|
|
|
1912
1914
|
options:
|
|
1913
1915
|
| (ObjectEncodingOptions & {
|
|
1914
1916
|
withFileTypes?: false | undefined;
|
|
1917
|
+
recursive?: boolean | undefined;
|
|
1915
1918
|
})
|
|
1916
1919
|
| BufferEncoding
|
|
1917
1920
|
| undefined
|
|
@@ -1932,6 +1935,7 @@ declare module 'fs' {
|
|
|
1932
1935
|
path: PathLike,
|
|
1933
1936
|
options: ObjectEncodingOptions & {
|
|
1934
1937
|
withFileTypes: true;
|
|
1938
|
+
recursive?: boolean | undefined;
|
|
1935
1939
|
},
|
|
1936
1940
|
callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void
|
|
1937
1941
|
): void;
|
|
@@ -1947,6 +1951,7 @@ declare module 'fs' {
|
|
|
1947
1951
|
| {
|
|
1948
1952
|
encoding: BufferEncoding | null;
|
|
1949
1953
|
withFileTypes?: false | undefined;
|
|
1954
|
+
recursive?: boolean | undefined;
|
|
1950
1955
|
}
|
|
1951
1956
|
| BufferEncoding
|
|
1952
1957
|
| null
|
|
@@ -1963,6 +1968,7 @@ declare module 'fs' {
|
|
|
1963
1968
|
| {
|
|
1964
1969
|
encoding: 'buffer';
|
|
1965
1970
|
withFileTypes?: false | undefined;
|
|
1971
|
+
recursive?: boolean | undefined;
|
|
1966
1972
|
}
|
|
1967
1973
|
): Promise<Buffer[]>;
|
|
1968
1974
|
/**
|
|
@@ -1975,6 +1981,7 @@ declare module 'fs' {
|
|
|
1975
1981
|
options?:
|
|
1976
1982
|
| (ObjectEncodingOptions & {
|
|
1977
1983
|
withFileTypes?: false | undefined;
|
|
1984
|
+
recursive?: boolean | undefined;
|
|
1978
1985
|
})
|
|
1979
1986
|
| BufferEncoding
|
|
1980
1987
|
| null
|
|
@@ -1988,6 +1995,7 @@ declare module 'fs' {
|
|
|
1988
1995
|
path: PathLike,
|
|
1989
1996
|
options: ObjectEncodingOptions & {
|
|
1990
1997
|
withFileTypes: true;
|
|
1998
|
+
recursive?: boolean | undefined;
|
|
1991
1999
|
}
|
|
1992
2000
|
): Promise<Dirent[]>;
|
|
1993
2001
|
}
|
|
@@ -2010,6 +2018,7 @@ declare module 'fs' {
|
|
|
2010
2018
|
| {
|
|
2011
2019
|
encoding: BufferEncoding | null;
|
|
2012
2020
|
withFileTypes?: false | undefined;
|
|
2021
|
+
recursive?: boolean | undefined;
|
|
2013
2022
|
}
|
|
2014
2023
|
| BufferEncoding
|
|
2015
2024
|
| null
|
|
@@ -2025,6 +2034,7 @@ declare module 'fs' {
|
|
|
2025
2034
|
| {
|
|
2026
2035
|
encoding: 'buffer';
|
|
2027
2036
|
withFileTypes?: false | undefined;
|
|
2037
|
+
recursive?: boolean | undefined;
|
|
2028
2038
|
}
|
|
2029
2039
|
| 'buffer'
|
|
2030
2040
|
): Buffer[];
|
|
@@ -2038,6 +2048,7 @@ declare module 'fs' {
|
|
|
2038
2048
|
options?:
|
|
2039
2049
|
| (ObjectEncodingOptions & {
|
|
2040
2050
|
withFileTypes?: false | undefined;
|
|
2051
|
+
recursive?: boolean | undefined;
|
|
2041
2052
|
})
|
|
2042
2053
|
| BufferEncoding
|
|
2043
2054
|
| null
|
|
@@ -2051,6 +2062,7 @@ declare module 'fs' {
|
|
|
2051
2062
|
path: PathLike,
|
|
2052
2063
|
options: ObjectEncodingOptions & {
|
|
2053
2064
|
withFileTypes: true;
|
|
2065
|
+
recursive?: boolean | undefined;
|
|
2054
2066
|
}
|
|
2055
2067
|
): Dirent[];
|
|
2056
2068
|
/**
|
|
@@ -3914,6 +3926,10 @@ declare module 'fs' {
|
|
|
3914
3926
|
* @default true
|
|
3915
3927
|
*/
|
|
3916
3928
|
force?: boolean;
|
|
3929
|
+
/**
|
|
3930
|
+
* Modifiers for copy operation. See `mode` flag of {@link copyFileSync()}
|
|
3931
|
+
*/
|
|
3932
|
+
mode?: number;
|
|
3917
3933
|
/**
|
|
3918
3934
|
* When `true` timestamps from `src` will
|
|
3919
3935
|
* be preserved.
|
|
@@ -185,6 +185,13 @@ declare module 'http' {
|
|
|
185
185
|
* @default 30000
|
|
186
186
|
*/
|
|
187
187
|
connectionsCheckingInterval?: number | undefined;
|
|
188
|
+
/**
|
|
189
|
+
* Optionally overrides all `socket`s' `readableHighWaterMark` and `writableHighWaterMark`.
|
|
190
|
+
* This affects `highWaterMark` property of both `IncomingMessage` and `ServerResponse`.
|
|
191
|
+
* Default: @see stream.getDefaultHighWaterMark().
|
|
192
|
+
* @since v18.17.0
|
|
193
|
+
*/
|
|
194
|
+
highWaterMark?: number | undefined;
|
|
188
195
|
/**
|
|
189
196
|
* Use an insecure HTTP parser that accepts invalid HTTP headers when `true`.
|
|
190
197
|
* Using the insecure parser should be avoided.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for non-npm package Node.js 18.
|
|
1
|
+
// Type definitions for non-npm package Node.js 18.17
|
|
2
2
|
// Project: https://nodejs.org/
|
|
3
3
|
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
|
|
4
4
|
// DefinitelyTyped <https://github.com/DefinitelyTyped>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.17.0",
|
|
4
4
|
"description": "TypeScript definitions for Node.js",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -232,6 +232,6 @@
|
|
|
232
232
|
},
|
|
233
233
|
"scripts": {},
|
|
234
234
|
"dependencies": {},
|
|
235
|
-
"typesPublisherContentHash": "
|
|
235
|
+
"typesPublisherContentHash": "72d9d1dd939f913f46921b0fbd07811abced1def0a635292b0619c1529597de8",
|
|
236
236
|
"typeScriptVersion": "4.3"
|
|
237
237
|
}
|
|
@@ -1097,6 +1097,20 @@ declare module 'stream' {
|
|
|
1097
1097
|
* @param stream a stream to attach a signal to
|
|
1098
1098
|
*/
|
|
1099
1099
|
function addAbortSignal<T extends Stream>(signal: AbortSignal, stream: T): T;
|
|
1100
|
+
/**
|
|
1101
|
+
* Returns the default highWaterMark used by streams.
|
|
1102
|
+
* Defaults to `16384` (16 KiB), or `16` for `objectMode`.
|
|
1103
|
+
* @since v18.17.0
|
|
1104
|
+
* @param objectMode
|
|
1105
|
+
*/
|
|
1106
|
+
function getDefaultHighWaterMark(objectMode: boolean): number;
|
|
1107
|
+
/**
|
|
1108
|
+
* Sets the default highWaterMark used by streams.
|
|
1109
|
+
* @since v18.17.0
|
|
1110
|
+
* @param objectMode
|
|
1111
|
+
* @param value highWaterMark value
|
|
1112
|
+
*/
|
|
1113
|
+
function setDefaultHighWaterMark(objectMode: boolean, value: number): void;
|
|
1100
1114
|
interface FinishedOptions extends Abortable {
|
|
1101
1115
|
error?: boolean | undefined;
|
|
1102
1116
|
readable?: boolean | undefined;
|
|
@@ -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
|
+
}
|