@types/node 22.2.0 → 22.4.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/README.md +1 -1
- node/buffer.d.ts +11 -0
- node/globals.d.ts +94 -0
- node/package.json +3 -3
- node/process.d.ts +121 -2
- node/test.d.ts +128 -1
- node/tls.d.ts +3 -0
- node/util.d.ts +6 -0
node/README.md
CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
9
9
|
|
10
10
|
### Additional Details
|
11
|
-
* Last updated: Fri,
|
11
|
+
* Last updated: Fri, 16 Aug 2024 18:09:07 GMT
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
13
13
|
|
14
14
|
# Credits
|
node/buffer.d.ts
CHANGED
@@ -170,6 +170,17 @@ declare module "buffer" {
|
|
170
170
|
* @since v15.7.0, v14.18.0
|
171
171
|
*/
|
172
172
|
arrayBuffer(): Promise<ArrayBuffer>;
|
173
|
+
/**
|
174
|
+
* The `blob.bytes()` method returns the byte of the `Blob` object as a `Promise<Uint8Array>`.
|
175
|
+
*
|
176
|
+
* ```js
|
177
|
+
* const blob = new Blob(['hello']);
|
178
|
+
* blob.bytes().then((bytes) => {
|
179
|
+
* console.log(bytes); // Outputs: Uint8Array(5) [ 104, 101, 108, 108, 111 ]
|
180
|
+
* });
|
181
|
+
* ```
|
182
|
+
*/
|
183
|
+
bytes(): Promise<Uint8Array>;
|
173
184
|
/**
|
174
185
|
* Creates and returns a new `Blob` containing a subset of this `Blob` objects
|
175
186
|
* data. The original `Blob` is not altered.
|
node/globals.d.ts
CHANGED
@@ -7,12 +7,14 @@ type _Request = typeof globalThis extends { onmessage: any } ? {} : import("undi
|
|
7
7
|
type _Response = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Response;
|
8
8
|
type _FormData = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").FormData;
|
9
9
|
type _Headers = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Headers;
|
10
|
+
type _MessageEvent = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").MessageEvent;
|
10
11
|
type _RequestInit = typeof globalThis extends { onmessage: any } ? {}
|
11
12
|
: import("undici-types").RequestInit;
|
12
13
|
type _ResponseInit = typeof globalThis extends { onmessage: any } ? {}
|
13
14
|
: import("undici-types").ResponseInit;
|
14
15
|
type _File = typeof globalThis extends { onmessage: any } ? {} : import("node:buffer").File;
|
15
16
|
type _WebSocket = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").WebSocket;
|
17
|
+
type _EventSource = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").EventSource;
|
16
18
|
// #endregion Fetch and friends
|
17
19
|
|
18
20
|
declare global {
|
@@ -101,6 +103,84 @@ declare global {
|
|
101
103
|
};
|
102
104
|
// #endregion borrowed
|
103
105
|
|
106
|
+
// #region Storage
|
107
|
+
/**
|
108
|
+
* This Web Storage API interface provides access to a particular domain's session or local storage. It allows, for example, the addition, modification, or deletion of stored data items.
|
109
|
+
*
|
110
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage)
|
111
|
+
*/
|
112
|
+
interface Storage {
|
113
|
+
/**
|
114
|
+
* Returns the number of key/value pairs.
|
115
|
+
*
|
116
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/length)
|
117
|
+
*/
|
118
|
+
readonly length: number;
|
119
|
+
/**
|
120
|
+
* Removes all key/value pairs, if there are any.
|
121
|
+
*
|
122
|
+
* Dispatches a storage event on Window objects holding an equivalent Storage object.
|
123
|
+
*
|
124
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/clear)
|
125
|
+
*/
|
126
|
+
clear(): void;
|
127
|
+
/**
|
128
|
+
* Returns the current value associated with the given key, or null if the given key does not exist.
|
129
|
+
*
|
130
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/getItem)
|
131
|
+
*/
|
132
|
+
getItem(key: string): string | null;
|
133
|
+
/**
|
134
|
+
* Returns the name of the nth key, or null if n is greater than or equal to the number of key/value pairs.
|
135
|
+
*
|
136
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/key)
|
137
|
+
*/
|
138
|
+
key(index: number): string | null;
|
139
|
+
/**
|
140
|
+
* Removes the key/value pair with the given key, if a key/value pair with the given key exists.
|
141
|
+
*
|
142
|
+
* Dispatches a storage event on Window objects holding an equivalent Storage object.
|
143
|
+
*
|
144
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/removeItem)
|
145
|
+
*/
|
146
|
+
removeItem(key: string): void;
|
147
|
+
/**
|
148
|
+
* Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
|
149
|
+
*
|
150
|
+
* Throws a "QuotaExceededError" DOMException exception if the new value couldn't be set. (Setting could fail if, e.g., the user has disabled storage for the site, or if the quota has been exceeded.)
|
151
|
+
*
|
152
|
+
* Dispatches a storage event on Window objects holding an equivalent Storage object.
|
153
|
+
*
|
154
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/setItem)
|
155
|
+
*/
|
156
|
+
setItem(key: string, value: string): void;
|
157
|
+
}
|
158
|
+
|
159
|
+
var Storage: typeof globalThis extends { onmessage: any; Storage: infer T } ? T
|
160
|
+
: {
|
161
|
+
prototype: Storage;
|
162
|
+
new(): Storage;
|
163
|
+
};
|
164
|
+
|
165
|
+
/**
|
166
|
+
* A browser-compatible implementation of [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage).
|
167
|
+
* Data is stored unencrypted in the file specified by the `--localstorage-file` CLI flag.
|
168
|
+
* Any modification of this data outside of the Web Storage API is not supported.
|
169
|
+
* Enable this API with the `--experimental-webstorage` CLI flag.
|
170
|
+
* @since v22.4.0
|
171
|
+
*/
|
172
|
+
var localStorage: Storage;
|
173
|
+
|
174
|
+
/**
|
175
|
+
* A browser-compatible implementation of [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage).
|
176
|
+
* Data is stored in memory, with a storage quota of 10 MB.
|
177
|
+
* Any modification of this data outside of the Web Storage API is not supported.
|
178
|
+
* Enable this API with the `--experimental-webstorage` CLI flag.
|
179
|
+
* @since v22.4.0
|
180
|
+
*/
|
181
|
+
var sessionStorage: Storage;
|
182
|
+
// #endregion Storage
|
183
|
+
|
104
184
|
// #region Disposable
|
105
185
|
interface SymbolConstructor {
|
106
186
|
/**
|
@@ -404,6 +484,13 @@ declare global {
|
|
404
484
|
} ? T
|
405
485
|
: typeof import("undici-types").Headers;
|
406
486
|
|
487
|
+
interface MessageEvent extends _MessageEvent {}
|
488
|
+
var MessageEvent: typeof globalThis extends {
|
489
|
+
onmessage: any;
|
490
|
+
MessageEvent: infer T;
|
491
|
+
} ? T
|
492
|
+
: typeof import("undici-types").MessageEvent;
|
493
|
+
|
407
494
|
interface File extends _File {}
|
408
495
|
var File: typeof globalThis extends {
|
409
496
|
onmessage: any;
|
@@ -414,4 +501,11 @@ declare global {
|
|
414
501
|
interface WebSocket extends _WebSocket {}
|
415
502
|
var WebSocket: typeof globalThis extends { onmessage: any; WebSocket: infer T } ? T
|
416
503
|
: typeof import("undici-types").WebSocket;
|
504
|
+
|
505
|
+
interface EventSource extends _EventSource {}
|
506
|
+
/**
|
507
|
+
* Only available through the [--experimental-eventsource](https://nodejs.org/api/cli.html#--experimental-eventsource) flag.
|
508
|
+
*/
|
509
|
+
var EventSource: typeof globalThis extends { onmessage: any; EventSource: infer T } ? T
|
510
|
+
: typeof import("undici-types").EventSource;
|
417
511
|
}
|
node/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/node",
|
3
|
-
"version": "22.
|
3
|
+
"version": "22.4.0",
|
4
4
|
"description": "TypeScript definitions for node",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
6
6
|
"license": "MIT",
|
@@ -210,8 +210,8 @@
|
|
210
210
|
},
|
211
211
|
"scripts": {},
|
212
212
|
"dependencies": {
|
213
|
-
"undici-types": "~6.
|
213
|
+
"undici-types": "~6.19.2"
|
214
214
|
},
|
215
|
-
"typesPublisherContentHash": "
|
215
|
+
"typesPublisherContentHash": "f22f2e87b11a05781ab2a2c4b7812aa834cf70e01e9db42c5288e6cc3f15fd47",
|
216
216
|
"typeScriptVersion": "4.8"
|
217
217
|
}
|
node/process.d.ts
CHANGED
@@ -1,8 +1,121 @@
|
|
1
1
|
declare module "process" {
|
2
|
-
import * as net from "node:net";
|
3
|
-
import * as os from "node:os";
|
4
2
|
import * as tty from "node:tty";
|
5
3
|
import { Worker } from "node:worker_threads";
|
4
|
+
|
5
|
+
interface BuiltInModule {
|
6
|
+
"assert": typeof import("assert");
|
7
|
+
"node:assert": typeof import("node:assert");
|
8
|
+
"assert/strict": typeof import("assert/strict");
|
9
|
+
"node:assert/strict": typeof import("node:assert/strict");
|
10
|
+
"async_hooks": typeof import("async_hooks");
|
11
|
+
"node:async_hooks": typeof import("node:async_hooks");
|
12
|
+
"buffer": typeof import("buffer");
|
13
|
+
"node:buffer": typeof import("node:buffer");
|
14
|
+
"child_process": typeof import("child_process");
|
15
|
+
"node:child_process": typeof import("node:child_process");
|
16
|
+
"cluster": typeof import("cluster");
|
17
|
+
"node:cluster": typeof import("node:cluster");
|
18
|
+
"console": typeof import("console");
|
19
|
+
"node:console": typeof import("node:console");
|
20
|
+
"constants": typeof import("constants");
|
21
|
+
"node:constants": typeof import("node:constants");
|
22
|
+
"crypto": typeof import("crypto");
|
23
|
+
"node:crypto": typeof import("node:crypto");
|
24
|
+
"dgram": typeof import("dgram");
|
25
|
+
"node:dgram": typeof import("node:dgram");
|
26
|
+
"diagnostics_channel": typeof import("diagnostics_channel");
|
27
|
+
"node:diagnostics_channel": typeof import("node:diagnostics_channel");
|
28
|
+
"dns": typeof import("dns");
|
29
|
+
"node:dns": typeof import("node:dns");
|
30
|
+
"dns/promises": typeof import("dns/promises");
|
31
|
+
"node:dns/promises": typeof import("node:dns/promises");
|
32
|
+
"domain": typeof import("domain");
|
33
|
+
"node:domain": typeof import("node:domain");
|
34
|
+
"events": typeof import("events");
|
35
|
+
"node:events": typeof import("node:events");
|
36
|
+
"fs": typeof import("fs");
|
37
|
+
"node:fs": typeof import("node:fs");
|
38
|
+
"fs/promises": typeof import("fs/promises");
|
39
|
+
"node:fs/promises": typeof import("node:fs/promises");
|
40
|
+
"http": typeof import("http");
|
41
|
+
"node:http": typeof import("node:http");
|
42
|
+
"http2": typeof import("http2");
|
43
|
+
"node:http2": typeof import("node:http2");
|
44
|
+
"https": typeof import("https");
|
45
|
+
"node:https": typeof import("node:https");
|
46
|
+
"inspector": typeof import("inspector");
|
47
|
+
"node:inspector": typeof import("node:inspector");
|
48
|
+
// FIXME: module is missed
|
49
|
+
// "inspector/promises": typeof import("inspector/promises");
|
50
|
+
// "node:inspector/promises": typeof import("node:inspector/promises");
|
51
|
+
"module": typeof import("module");
|
52
|
+
"node:module": typeof import("node:module");
|
53
|
+
"net": typeof import("net");
|
54
|
+
"node:net": typeof import("node:net");
|
55
|
+
"os": typeof import("os");
|
56
|
+
"node:os": typeof import("node:os");
|
57
|
+
"path": typeof import("path");
|
58
|
+
"node:path": typeof import("node:path");
|
59
|
+
"path/posix": typeof import("path/posix");
|
60
|
+
"node:path/posix": typeof import("node:path/posix");
|
61
|
+
"path/win32": typeof import("path/win32");
|
62
|
+
"node:path/win32": typeof import("node:path/win32");
|
63
|
+
"perf_hooks": typeof import("perf_hooks");
|
64
|
+
"node:perf_hooks": typeof import("node:perf_hooks");
|
65
|
+
"process": typeof import("process");
|
66
|
+
"node:process": typeof import("node:process");
|
67
|
+
"punycode": typeof import("punycode");
|
68
|
+
"node:punycode": typeof import("node:punycode");
|
69
|
+
"querystring": typeof import("querystring");
|
70
|
+
"node:querystring": typeof import("node:querystring");
|
71
|
+
"readline": typeof import("readline");
|
72
|
+
"node:readline": typeof import("node:readline");
|
73
|
+
"readline/promises": typeof import("readline/promises");
|
74
|
+
"node:readline/promises": typeof import("node:readline/promises");
|
75
|
+
"repl": typeof import("repl");
|
76
|
+
"node:repl": typeof import("node:repl");
|
77
|
+
"node:sea": typeof import("node:sea");
|
78
|
+
"stream": typeof import("stream");
|
79
|
+
"node:stream": typeof import("node:stream");
|
80
|
+
"stream/consumers": typeof import("stream/consumers");
|
81
|
+
"node:stream/consumers": typeof import("node:stream/consumers");
|
82
|
+
"stream/promises": typeof import("stream/promises");
|
83
|
+
"node:stream/promises": typeof import("node:stream/promises");
|
84
|
+
"stream/web": typeof import("stream/web");
|
85
|
+
"node:stream/web": typeof import("node:stream/web");
|
86
|
+
"string_decoder": typeof import("string_decoder");
|
87
|
+
"node:string_decoder": typeof import("node:string_decoder");
|
88
|
+
"node:test": typeof import("node:test");
|
89
|
+
"node:test/reporters": typeof import("node:test/reporters");
|
90
|
+
"timers": typeof import("timers");
|
91
|
+
"node:timers": typeof import("node:timers");
|
92
|
+
"timers/promises": typeof import("timers/promises");
|
93
|
+
"node:timers/promises": typeof import("node:timers/promises");
|
94
|
+
"tls": typeof import("tls");
|
95
|
+
"node:tls": typeof import("node:tls");
|
96
|
+
"trace_events": typeof import("trace_events");
|
97
|
+
"node:trace_events": typeof import("node:trace_events");
|
98
|
+
"tty": typeof import("tty");
|
99
|
+
"node:tty": typeof import("node:tty");
|
100
|
+
"url": typeof import("url");
|
101
|
+
"node:url": typeof import("node:url");
|
102
|
+
"util": typeof import("util");
|
103
|
+
"node:util": typeof import("node:util");
|
104
|
+
"sys": typeof import("util");
|
105
|
+
"node:sys": typeof import("node:util");
|
106
|
+
"util/types": typeof import("util/types");
|
107
|
+
"node:util/types": typeof import("node:util/types");
|
108
|
+
"v8": typeof import("v8");
|
109
|
+
"node:v8": typeof import("node:v8");
|
110
|
+
"vm": typeof import("vm");
|
111
|
+
"node:vm": typeof import("node:vm");
|
112
|
+
"wasi": typeof import("wasi");
|
113
|
+
"node:wasi": typeof import("node:wasi");
|
114
|
+
"worker_threads": typeof import("worker_threads");
|
115
|
+
"node:worker_threads": typeof import("node:worker_threads");
|
116
|
+
"zlib": typeof import("zlib");
|
117
|
+
"node:zlib": typeof import("node:zlib");
|
118
|
+
}
|
6
119
|
global {
|
7
120
|
var process: NodeJS.Process;
|
8
121
|
namespace NodeJS {
|
@@ -793,6 +906,12 @@ declare module "process" {
|
|
793
906
|
* @since v17.3.0, v16.14.0
|
794
907
|
*/
|
795
908
|
getActiveResourcesInfo(): string[];
|
909
|
+
/**
|
910
|
+
* Provides a way to load built-in modules in a globally available function.
|
911
|
+
* @param id ID of the built-in module being requested.
|
912
|
+
*/
|
913
|
+
getBuiltinModule<ID extends keyof BuiltInModule>(id: ID): BuiltInModule[ID];
|
914
|
+
getBuiltinModule(id: string): object | undefined;
|
796
915
|
/**
|
797
916
|
* The `process.getgid()` method returns the numerical group identity of the
|
798
917
|
* process. (See [`getgid(2)`](http://man7.org/linux/man-pages/man2/getgid.2.html).)
|
node/test.d.ts
CHANGED
@@ -144,7 +144,22 @@ declare module "node:test" {
|
|
144
144
|
function test(options?: TestOptions, fn?: TestFn): Promise<void>;
|
145
145
|
function test(fn?: TestFn): Promise<void>;
|
146
146
|
namespace test {
|
147
|
-
export {
|
147
|
+
export {
|
148
|
+
after,
|
149
|
+
afterEach,
|
150
|
+
before,
|
151
|
+
beforeEach,
|
152
|
+
describe,
|
153
|
+
it,
|
154
|
+
mock,
|
155
|
+
only,
|
156
|
+
run,
|
157
|
+
skip,
|
158
|
+
snapshot,
|
159
|
+
suite,
|
160
|
+
test,
|
161
|
+
todo,
|
162
|
+
};
|
148
163
|
}
|
149
164
|
/**
|
150
165
|
* The `suite()` function is imported from the `node:test` module.
|
@@ -509,6 +524,11 @@ declare module "node:test" {
|
|
509
524
|
* @param message Message to be reported.
|
510
525
|
*/
|
511
526
|
diagnostic(message: string): void;
|
527
|
+
/**
|
528
|
+
* The name of the test and each of its ancestors, separated by `>`.
|
529
|
+
* @since v22.3.0
|
530
|
+
*/
|
531
|
+
readonly fullName: string;
|
512
532
|
/**
|
513
533
|
* The name of the test.
|
514
534
|
* @since v18.8.0, v16.18.0
|
@@ -695,6 +715,36 @@ declare module "node:test" {
|
|
695
715
|
* Identical to the `throws` function from the `node:assert` module, but bound to the test context.
|
696
716
|
*/
|
697
717
|
throws: typeof import("node:assert").throws;
|
718
|
+
/**
|
719
|
+
* This function implements assertions for snapshot testing.
|
720
|
+
* ```js
|
721
|
+
* test('snapshot test with default serialization', (t) => {
|
722
|
+
* t.assert.snapshot({ value1: 1, value2: 2 });
|
723
|
+
* });
|
724
|
+
*
|
725
|
+
* test('snapshot test with custom serialization', (t) => {
|
726
|
+
* t.assert.snapshot({ value3: 3, value4: 4 }, {
|
727
|
+
* serializers: [(value) => JSON.stringify(value)]
|
728
|
+
* });
|
729
|
+
* });
|
730
|
+
* ```
|
731
|
+
*
|
732
|
+
* Only available through the [--experimental-test-snapshots](https://nodejs.org/api/cli.html#--experimental-test-snapshots) flag.
|
733
|
+
* @since v22.3.0
|
734
|
+
* @experimental
|
735
|
+
*/
|
736
|
+
snapshot(value: any, options?: AssertSnapshotOptions): void;
|
737
|
+
}
|
738
|
+
interface AssertSnapshotOptions {
|
739
|
+
/**
|
740
|
+
* An array of synchronous functions used to serialize `value` into a string.
|
741
|
+
* `value` is passed as the only argument to the first serializer function.
|
742
|
+
* The return value of each serializer is passed as input to the next serializer.
|
743
|
+
* Once all serializers have run, the resulting value is coerced to a string.
|
744
|
+
*
|
745
|
+
* If no serializers are provided, the test runner's default serializers are used.
|
746
|
+
*/
|
747
|
+
serializers?: ReadonlyArray<(value: any) => any> | undefined;
|
698
748
|
}
|
699
749
|
|
700
750
|
/**
|
@@ -879,6 +929,30 @@ declare module "node:test" {
|
|
879
929
|
type FunctionPropertyNames<T> = {
|
880
930
|
[K in keyof T]: T[K] extends Function ? K : never;
|
881
931
|
}[keyof T];
|
932
|
+
interface MockModuleOptions {
|
933
|
+
/**
|
934
|
+
* If false, each call to `require()` or `import()` generates a new mock module.
|
935
|
+
* If true, subsequent calls will return the same module mock, and the mock module is inserted into the CommonJS cache.
|
936
|
+
* @default false
|
937
|
+
*/
|
938
|
+
cache?: boolean | undefined;
|
939
|
+
/**
|
940
|
+
* The value to use as the mocked module's default export.
|
941
|
+
*
|
942
|
+
* If this value is not provided, ESM mocks do not include a default export.
|
943
|
+
* If the mock is a CommonJS or builtin module, this setting is used as the value of `module.exports`.
|
944
|
+
* If this value is not provided, CJS and builtin mocks use an empty object as the value of `module.exports`.
|
945
|
+
*/
|
946
|
+
defaultExport?: any;
|
947
|
+
/**
|
948
|
+
* An object whose keys and values are used to create the named exports of the mock module.
|
949
|
+
*
|
950
|
+
* If the mock is a CommonJS or builtin module, these values are copied onto `module.exports`.
|
951
|
+
* Therefore, if a mock is created with both named exports and a non-object default export,
|
952
|
+
* the mock will throw an exception when used as a CJS or builtin module.
|
953
|
+
*/
|
954
|
+
namedExports?: object | undefined;
|
955
|
+
}
|
882
956
|
/**
|
883
957
|
* The `MockTracker` class is used to manage mocking functionality. The test runner
|
884
958
|
* module provides a top level `mock` export which is a `MockTracker` instance.
|
@@ -1042,6 +1116,18 @@ declare module "node:test" {
|
|
1042
1116
|
options?: MockFunctionOptions,
|
1043
1117
|
): Mock<((value: MockedObject[MethodName]) => void) | Implementation>;
|
1044
1118
|
|
1119
|
+
/**
|
1120
|
+
* This function is used to mock the exports of ECMAScript modules, CommonJS modules, and Node.js builtin modules.
|
1121
|
+
* Any references to the original module prior to mocking are not impacted.
|
1122
|
+
*
|
1123
|
+
* Only available through the [--experimental-test-module-mocks](https://nodejs.org/api/cli.html#--experimental-test-module-mocks) flag.
|
1124
|
+
* @since v22.3.0
|
1125
|
+
* @experimental
|
1126
|
+
* @param specifier A string identifying the module to mock.
|
1127
|
+
* @param options Optional configuration options for the mock module.
|
1128
|
+
*/
|
1129
|
+
module(specifier: string, options?: MockModuleOptions): MockModuleContext;
|
1130
|
+
|
1045
1131
|
/**
|
1046
1132
|
* This function restores the default behavior of all mocks that were previously
|
1047
1133
|
* created by this `MockTracker` and disassociates the mocks from the `MockTracker` instance. Once disassociated, the mocks can still be used, but the `MockTracker` instance can no longer be
|
@@ -1201,6 +1287,17 @@ declare module "node:test" {
|
|
1201
1287
|
*/
|
1202
1288
|
restore(): void;
|
1203
1289
|
}
|
1290
|
+
/**
|
1291
|
+
* @since v22.3.0
|
1292
|
+
* @experimental
|
1293
|
+
*/
|
1294
|
+
class MockModuleContext {
|
1295
|
+
/**
|
1296
|
+
* Resets the implementation of the mock module.
|
1297
|
+
* @since v22.3.0
|
1298
|
+
*/
|
1299
|
+
restore(): void;
|
1300
|
+
}
|
1204
1301
|
|
1205
1302
|
type Timer = "setInterval" | "setTimeout" | "setImmediate" | "Date";
|
1206
1303
|
interface MockTimersOptions {
|
@@ -1423,6 +1520,35 @@ declare module "node:test" {
|
|
1423
1520
|
*/
|
1424
1521
|
[Symbol.dispose](): void;
|
1425
1522
|
}
|
1523
|
+
/**
|
1524
|
+
* Only available through the [--experimental-test-snapshots](https://nodejs.org/api/cli.html#--experimental-test-snapshots) flag.
|
1525
|
+
* @since v22.3.0
|
1526
|
+
* @experimental
|
1527
|
+
*/
|
1528
|
+
namespace snapshot {
|
1529
|
+
/**
|
1530
|
+
* This function is used to customize the default serialization mechanism used by the test runner.
|
1531
|
+
*
|
1532
|
+
* By default, the test runner performs serialization by calling `JSON.stringify(value, null, 2)` on the provided value.
|
1533
|
+
* `JSON.stringify()` does have limitations regarding circular structures and supported data types.
|
1534
|
+
* If a more robust serialization mechanism is required, this function should be used to specify a list of custom serializers.
|
1535
|
+
*
|
1536
|
+
* Serializers are called in order, with the output of the previous serializer passed as input to the next.
|
1537
|
+
* The final result must be a string value.
|
1538
|
+
* @since v22.3.0
|
1539
|
+
* @param serializers An array of synchronous functions used as the default serializers for snapshot tests.
|
1540
|
+
*/
|
1541
|
+
function setDefaultSnapshotSerializers(serializers: ReadonlyArray<(value: any) => any>): void;
|
1542
|
+
/**
|
1543
|
+
* This function is used to set a custom resolver for the location of the snapshot file used for snapshot testing.
|
1544
|
+
* By default, the snapshot filename is the same as the entry point filename with `.snapshot` appended.
|
1545
|
+
* @since v22.3.0
|
1546
|
+
* @param fn A function which returns a string specifying the location of the snapshot file.
|
1547
|
+
* The function receives the path of the test file as its only argument.
|
1548
|
+
* If `process.argv[1]` is not associated with a file (for example in the REPL), the input is undefined.
|
1549
|
+
*/
|
1550
|
+
function setResolveSnapshotPath(fn: (path: string | undefined) => string): void;
|
1551
|
+
}
|
1426
1552
|
export {
|
1427
1553
|
after,
|
1428
1554
|
afterEach,
|
@@ -1435,6 +1561,7 @@ declare module "node:test" {
|
|
1435
1561
|
only,
|
1436
1562
|
run,
|
1437
1563
|
skip,
|
1564
|
+
snapshot,
|
1438
1565
|
suite,
|
1439
1566
|
SuiteContext,
|
1440
1567
|
test,
|
node/tls.d.ts
CHANGED
@@ -843,6 +843,7 @@ declare module "tls" {
|
|
843
843
|
ciphers?: string | undefined;
|
844
844
|
/**
|
845
845
|
* Name of an OpenSSL engine which can provide the client certificate.
|
846
|
+
* @deprecated
|
846
847
|
*/
|
847
848
|
clientCertEngine?: string | undefined;
|
848
849
|
/**
|
@@ -885,12 +886,14 @@ declare module "tls" {
|
|
885
886
|
/**
|
886
887
|
* Name of an OpenSSL engine to get private key from. Should be used
|
887
888
|
* together with privateKeyIdentifier.
|
889
|
+
* @deprecated
|
888
890
|
*/
|
889
891
|
privateKeyEngine?: string | undefined;
|
890
892
|
/**
|
891
893
|
* Identifier of a private key managed by an OpenSSL engine. Should be
|
892
894
|
* used together with privateKeyEngine. Should not be set together with
|
893
895
|
* key, because both options define a private key in different ways.
|
896
|
+
* @deprecated
|
894
897
|
*/
|
895
898
|
privateKeyIdentifier?: string | undefined;
|
896
899
|
/**
|
node/util.d.ts
CHANGED
@@ -1480,6 +1480,12 @@ declare module "util" {
|
|
1480
1480
|
* Whether this command accepts positional arguments.
|
1481
1481
|
*/
|
1482
1482
|
allowPositionals?: boolean | undefined;
|
1483
|
+
/**
|
1484
|
+
* If `true`, allows explicitly setting boolean options to `false` by prefixing the option name with `--no-`.
|
1485
|
+
* @default false
|
1486
|
+
* @since v22.4.0
|
1487
|
+
*/
|
1488
|
+
allowNegative?: boolean | undefined;
|
1483
1489
|
/**
|
1484
1490
|
* Return the parsed tokens. This is useful for extending the built-in behavior,
|
1485
1491
|
* from adding additional checks through to reprocessing the tokens in different ways.
|