@types/node 20.19.25 → 24.10.4
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 v20.19 → node v24.10}/README.md +3 -3
- node v24.10/assert/strict.d.ts +111 -0
- {node v20.19 → node v24.10}/assert.d.ts +150 -97
- {node v20.19 → node v24.10}/async_hooks.d.ts +27 -9
- {node v20.19 → node v24.10}/buffer.buffer.d.ts +2 -1
- {node v20.19 → node v24.10}/buffer.d.ts +6 -8
- {node v20.19 → node v24.10}/child_process.d.ts +11 -10
- {node v20.19 → node v24.10}/cluster.d.ts +16 -15
- {node v20.19 → node v24.10}/console.d.ts +19 -18
- {node v20.19 → node v24.10}/crypto.d.ts +1120 -293
- {node v20.19 → node v24.10}/dgram.d.ts +5 -2
- {node v20.19 → node v24.10}/diagnostics_channel.d.ts +1 -3
- {node v20.19 → node v24.10}/dns/promises.d.ts +30 -6
- {node v20.19 → node v24.10}/dns.d.ts +69 -17
- {node v20.19 → node v24.10}/domain.d.ts +1 -1
- {node v20.19 → node v24.10}/events.d.ts +1 -2
- {node v20.19 → node v24.10}/fs/promises.d.ts +85 -38
- {node v20.19 → node v24.10}/fs.d.ts +387 -48
- {node v20.19 → node v24.10}/globals.d.ts +2 -4
- {node v20.19 → node v24.10}/globals.typedarray.d.ts +3 -0
- {node v20.19 → node v24.10}/http.d.ts +90 -5
- {node v20.19 → node v24.10}/http2.d.ts +166 -41
- {node v20.19 → node v24.10}/https.d.ts +4 -3
- {node v20.19 → node v24.10}/index.d.ts +13 -5
- node v24.10/inspector.d.ts +277 -0
- {node v20.19 → node v24.10}/inspector.generated.d.ts +1096 -829
- {node v20.19 → node v24.10}/module.d.ts +403 -48
- {node v20.19 → node v24.10}/net.d.ts +62 -20
- {node v20.19 → node v24.10}/os.d.ts +8 -7
- {node v20.19 → node v24.10}/package.json +18 -3
- {node v20.19 → node v24.10}/path.d.ts +3 -3
- {node v20.19 → node v24.10}/perf_hooks.d.ts +37 -16
- {node v20.19 → node v24.10}/process.d.ts +138 -16
- {node v20.19 → node v24.10}/punycode.d.ts +1 -1
- {node v20.19 → node v24.10}/querystring.d.ts +1 -1
- {node v20.19 → node v24.10}/readline/promises.d.ts +0 -1
- {node v20.19 → node v24.10}/readline.d.ts +19 -14
- {node v20.19 → node v24.10}/repl.d.ts +25 -17
- {node v20.19 → node v24.10}/sea.d.ts +11 -2
- node v24.10/sqlite.d.ts +937 -0
- {node v20.19 → node v24.10}/stream/web.d.ts +85 -45
- {node v20.19 → node v24.10}/stream.d.ts +36 -28
- {node v20.19 → node v24.10}/string_decoder.d.ts +1 -1
- {node v20.19 → node v24.10}/test.d.ts +587 -35
- {node v20.19 → node v24.10}/timers/promises.d.ts +1 -1
- {node v20.19 → node v24.10}/timers.d.ts +4 -5
- {node v20.19 → node v24.10}/tls.d.ts +62 -48
- {node v20.19 → node v24.10}/trace_events.d.ts +6 -6
- node v24.10/ts5.6/compatibility/float16array.d.ts +71 -0
- {node v20.19 → node v24.10}/ts5.6/globals.typedarray.d.ts +2 -0
- {node v20.19 → node v24.10}/ts5.6/index.d.ts +15 -5
- node v24.10/ts5.7/compatibility/float16array.d.ts +72 -0
- node v24.10/ts5.7/index.d.ts +103 -0
- {node v20.19 → node v24.10}/tty.d.ts +1 -1
- {node v20.19 → node v24.10}/url.d.ts +128 -35
- {node v20.19 → node v24.10}/util.d.ts +384 -390
- {node v20.19 → node v24.10}/v8.d.ts +175 -32
- {node v20.19 → node v24.10}/vm.d.ts +246 -67
- {node v20.19 → node v24.10}/wasi.d.ts +23 -2
- node v24.10/web-globals/crypto.d.ts +32 -0
- {node v20.19 → node v24.10}/web-globals/fetch.d.ts +4 -0
- node v24.10/web-globals/navigator.d.ts +25 -0
- node v24.10/web-globals/storage.d.ts +24 -0
- node v24.10/web-globals/streams.d.ts +22 -0
- {node v20.19 → node v24.10}/worker_threads.d.ts +205 -24
- {node v20.19 → node v24.10}/zlib.d.ts +185 -44
- node v20.19/assert/strict.d.ts +0 -8
- node v20.19/compatibility/disposable.d.ts +0 -16
- node v20.19/compatibility/index.d.ts +0 -9
- node v20.19/compatibility/indexable.d.ts +0 -20
- {node v20.19 → node v24.10}/LICENSE +0 -0
- {node v20.19 → node v24.10}/compatibility/iterators.d.ts +0 -0
- {node v20.19 → node v24.10}/constants.d.ts +0 -0
- {node v20.19 → node v24.10}/stream/consumers.d.ts +0 -0
- {node v20.19 → node v24.10}/stream/promises.d.ts +0 -0
- {node v20.19 → node v24.10}/ts5.6/buffer.buffer.d.ts +0 -0
- {node v20.19 → node v24.10}/web-globals/abortcontroller.d.ts +0 -0
- {node v20.19 → node v24.10}/web-globals/domexception.d.ts +0 -0
- {node v20.19 → node v24.10}/web-globals/events.d.ts +0 -0
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
This package contains type definitions for node (https://nodejs.org/).
|
|
6
6
|
|
|
7
7
|
# Details
|
|
8
|
-
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/
|
|
8
|
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v24.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Sun, 14 Dec 2025 00:04:32 GMT
|
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
|
13
13
|
|
|
14
14
|
# Credits
|
|
15
|
-
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [Alberto Schiabel](https://github.com/jkomyno), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [David Junger](https://github.com/touffy), [Mohsen Azimi](https://github.com/mohsen1), [Nikita Galkin](https://github.com/galkin), [Sebastian Silbermann](https://github.com/eps1lon), [Wilco Bakker](https://github.com/WilcoBakker), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina),
|
|
15
|
+
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [Alberto Schiabel](https://github.com/jkomyno), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [David Junger](https://github.com/touffy), [Mohsen Azimi](https://github.com/mohsen1), [Nikita Galkin](https://github.com/galkin), [Sebastian Silbermann](https://github.com/eps1lon), [Wilco Bakker](https://github.com/WilcoBakker), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), [Dmitry Semigradsky](https://github.com/Semigradsky), [René](https://github.com/Renegade334), and [Yagiz Nizipli](https://github.com/anonrig).
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In strict assertion mode, non-strict methods behave like their corresponding
|
|
3
|
+
* strict methods. For example, `assert.deepEqual()` will behave like
|
|
4
|
+
* `assert.deepStrictEqual()`.
|
|
5
|
+
*
|
|
6
|
+
* In strict assertion mode, error messages for objects display a diff. In legacy
|
|
7
|
+
* assertion mode, error messages for objects display the objects, often truncated.
|
|
8
|
+
*
|
|
9
|
+
* To use strict assertion mode:
|
|
10
|
+
*
|
|
11
|
+
* ```js
|
|
12
|
+
* import { strict as assert } from 'node:assert';
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* ```js
|
|
16
|
+
* import assert from 'node:assert/strict';
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* Example error diff:
|
|
20
|
+
*
|
|
21
|
+
* ```js
|
|
22
|
+
* import { strict as assert } from 'node:assert';
|
|
23
|
+
*
|
|
24
|
+
* assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
|
|
25
|
+
* // AssertionError: Expected inputs to be strictly deep-equal:
|
|
26
|
+
* // + actual - expected ... Lines skipped
|
|
27
|
+
* //
|
|
28
|
+
* // [
|
|
29
|
+
* // [
|
|
30
|
+
* // ...
|
|
31
|
+
* // 2,
|
|
32
|
+
* // + 3
|
|
33
|
+
* // - '3'
|
|
34
|
+
* // ],
|
|
35
|
+
* // ...
|
|
36
|
+
* // 5
|
|
37
|
+
* // ]
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS`
|
|
41
|
+
* environment variables. This will also deactivate the colors in the REPL. For
|
|
42
|
+
* more on color support in terminal environments, read the tty
|
|
43
|
+
* [`getColorDepth()`](https://nodejs.org/docs/latest-v24.x/api/tty.html#writestreamgetcolordepthenv) documentation.
|
|
44
|
+
* @since v15.0.0
|
|
45
|
+
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/assert/strict.js)
|
|
46
|
+
*/
|
|
47
|
+
declare module "assert/strict" {
|
|
48
|
+
import {
|
|
49
|
+
Assert,
|
|
50
|
+
AssertionError,
|
|
51
|
+
AssertionErrorOptions,
|
|
52
|
+
AssertOptions,
|
|
53
|
+
AssertPredicate,
|
|
54
|
+
AssertStrict,
|
|
55
|
+
CallTracker,
|
|
56
|
+
CallTrackerCall,
|
|
57
|
+
CallTrackerReportInformation,
|
|
58
|
+
deepStrictEqual,
|
|
59
|
+
doesNotMatch,
|
|
60
|
+
doesNotReject,
|
|
61
|
+
doesNotThrow,
|
|
62
|
+
fail,
|
|
63
|
+
ifError,
|
|
64
|
+
match,
|
|
65
|
+
notDeepStrictEqual,
|
|
66
|
+
notStrictEqual,
|
|
67
|
+
ok,
|
|
68
|
+
partialDeepStrictEqual,
|
|
69
|
+
rejects,
|
|
70
|
+
strictEqual,
|
|
71
|
+
throws,
|
|
72
|
+
} from "node:assert";
|
|
73
|
+
function strict(value: unknown, message?: string | Error): asserts value;
|
|
74
|
+
namespace strict {
|
|
75
|
+
export {
|
|
76
|
+
Assert,
|
|
77
|
+
AssertionError,
|
|
78
|
+
AssertionErrorOptions,
|
|
79
|
+
AssertOptions,
|
|
80
|
+
AssertPredicate,
|
|
81
|
+
AssertStrict,
|
|
82
|
+
CallTracker,
|
|
83
|
+
CallTrackerCall,
|
|
84
|
+
CallTrackerReportInformation,
|
|
85
|
+
deepStrictEqual,
|
|
86
|
+
deepStrictEqual as deepEqual,
|
|
87
|
+
doesNotMatch,
|
|
88
|
+
doesNotReject,
|
|
89
|
+
doesNotThrow,
|
|
90
|
+
fail,
|
|
91
|
+
ifError,
|
|
92
|
+
match,
|
|
93
|
+
notDeepStrictEqual,
|
|
94
|
+
notDeepStrictEqual as notDeepEqual,
|
|
95
|
+
notStrictEqual,
|
|
96
|
+
notStrictEqual as notEqual,
|
|
97
|
+
ok,
|
|
98
|
+
partialDeepStrictEqual,
|
|
99
|
+
rejects,
|
|
100
|
+
strict,
|
|
101
|
+
strictEqual,
|
|
102
|
+
strictEqual as equal,
|
|
103
|
+
throws,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
export = strict;
|
|
107
|
+
}
|
|
108
|
+
declare module "node:assert/strict" {
|
|
109
|
+
import strict = require("assert/strict");
|
|
110
|
+
export = strict;
|
|
111
|
+
}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `node:assert` module provides a set of assertion functions for verifying
|
|
3
3
|
* invariants.
|
|
4
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
4
|
+
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/assert.js)
|
|
5
5
|
*/
|
|
6
6
|
declare module "assert" {
|
|
7
|
+
import strict = require("assert/strict");
|
|
7
8
|
/**
|
|
8
|
-
* An alias of {@link ok}.
|
|
9
|
+
* An alias of {@link assert.ok}.
|
|
9
10
|
* @since v0.5.9
|
|
10
11
|
* @param value The input that is checked for being truthy.
|
|
11
12
|
*/
|
|
12
13
|
function assert(value: unknown, message?: string | Error): asserts value;
|
|
14
|
+
const kOptions: unique symbol;
|
|
13
15
|
namespace assert {
|
|
14
16
|
type AssertMethodNames =
|
|
15
17
|
| "deepEqual"
|
|
@@ -26,13 +28,139 @@ declare module "assert" {
|
|
|
26
28
|
| "notEqual"
|
|
27
29
|
| "notStrictEqual"
|
|
28
30
|
| "ok"
|
|
31
|
+
| "partialDeepStrictEqual"
|
|
29
32
|
| "rejects"
|
|
30
33
|
| "strictEqual"
|
|
31
34
|
| "throws";
|
|
35
|
+
interface AssertOptions {
|
|
36
|
+
/**
|
|
37
|
+
* If set to `'full'`, shows the full diff in assertion errors.
|
|
38
|
+
* @default 'simple'
|
|
39
|
+
*/
|
|
40
|
+
diff?: "simple" | "full" | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* If set to `true`, non-strict methods behave like their
|
|
43
|
+
* corresponding strict methods.
|
|
44
|
+
* @default true
|
|
45
|
+
*/
|
|
46
|
+
strict?: boolean | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* If set to `true`, skips prototype and constructor
|
|
49
|
+
* comparison in deep equality checks.
|
|
50
|
+
* @since v24.9.0
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
skipPrototype?: boolean | undefined;
|
|
54
|
+
}
|
|
55
|
+
interface Assert extends Pick<typeof assert, AssertMethodNames> {
|
|
56
|
+
readonly [kOptions]: AssertOptions & { strict: false };
|
|
57
|
+
}
|
|
58
|
+
interface AssertStrict extends Pick<typeof strict, AssertMethodNames> {
|
|
59
|
+
readonly [kOptions]: AssertOptions & { strict: true };
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The `Assert` class allows creating independent assertion instances with custom options.
|
|
63
|
+
* @since v24.6.0
|
|
64
|
+
*/
|
|
65
|
+
var Assert: {
|
|
66
|
+
/**
|
|
67
|
+
* Creates a new assertion instance. The `diff` option controls the verbosity of diffs in assertion error messages.
|
|
68
|
+
*
|
|
69
|
+
* ```js
|
|
70
|
+
* const { Assert } = require('node:assert');
|
|
71
|
+
* const assertInstance = new Assert({ diff: 'full' });
|
|
72
|
+
* assertInstance.deepStrictEqual({ a: 1 }, { a: 2 });
|
|
73
|
+
* // Shows a full diff in the error message.
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* **Important**: When destructuring assertion methods from an `Assert` instance,
|
|
77
|
+
* the methods lose their connection to the instance's configuration options (such
|
|
78
|
+
* as `diff`, `strict`, and `skipPrototype` settings).
|
|
79
|
+
* The destructured methods will fall back to default behavior instead.
|
|
80
|
+
*
|
|
81
|
+
* ```js
|
|
82
|
+
* const myAssert = new Assert({ diff: 'full' });
|
|
83
|
+
*
|
|
84
|
+
* // This works as expected - uses 'full' diff
|
|
85
|
+
* myAssert.strictEqual({ a: 1 }, { b: { c: 1 } });
|
|
86
|
+
*
|
|
87
|
+
* // This loses the 'full' diff setting - falls back to default 'simple' diff
|
|
88
|
+
* const { strictEqual } = myAssert;
|
|
89
|
+
* strictEqual({ a: 1 }, { b: { c: 1 } });
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* The `skipPrototype` option affects all deep equality methods:
|
|
93
|
+
*
|
|
94
|
+
* ```js
|
|
95
|
+
* class Foo {
|
|
96
|
+
* constructor(a) {
|
|
97
|
+
* this.a = a;
|
|
98
|
+
* }
|
|
99
|
+
* }
|
|
100
|
+
*
|
|
101
|
+
* class Bar {
|
|
102
|
+
* constructor(a) {
|
|
103
|
+
* this.a = a;
|
|
104
|
+
* }
|
|
105
|
+
* }
|
|
106
|
+
*
|
|
107
|
+
* const foo = new Foo(1);
|
|
108
|
+
* const bar = new Bar(1);
|
|
109
|
+
*
|
|
110
|
+
* // Default behavior - fails due to different constructors
|
|
111
|
+
* const assert1 = new Assert();
|
|
112
|
+
* assert1.deepStrictEqual(foo, bar); // AssertionError
|
|
113
|
+
*
|
|
114
|
+
* // Skip prototype comparison - passes if properties are equal
|
|
115
|
+
* const assert2 = new Assert({ skipPrototype: true });
|
|
116
|
+
* assert2.deepStrictEqual(foo, bar); // OK
|
|
117
|
+
* ```
|
|
118
|
+
*
|
|
119
|
+
* When destructured, methods lose access to the instance's `this` context and revert to default assertion behavior
|
|
120
|
+
* (diff: 'simple', non-strict mode).
|
|
121
|
+
* To maintain custom options when using destructured methods, avoid
|
|
122
|
+
* destructuring and call methods directly on the instance.
|
|
123
|
+
* @since v24.6.0
|
|
124
|
+
*/
|
|
125
|
+
new(
|
|
126
|
+
options?: AssertOptions & { strict?: true | undefined },
|
|
127
|
+
): AssertStrict;
|
|
128
|
+
new(
|
|
129
|
+
options: AssertOptions,
|
|
130
|
+
): Assert;
|
|
131
|
+
};
|
|
132
|
+
interface AssertionErrorOptions {
|
|
133
|
+
/**
|
|
134
|
+
* If provided, the error message is set to this value.
|
|
135
|
+
*/
|
|
136
|
+
message?: string | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* The `actual` property on the error instance.
|
|
139
|
+
*/
|
|
140
|
+
actual?: unknown;
|
|
141
|
+
/**
|
|
142
|
+
* The `expected` property on the error instance.
|
|
143
|
+
*/
|
|
144
|
+
expected?: unknown;
|
|
145
|
+
/**
|
|
146
|
+
* The `operator` property on the error instance.
|
|
147
|
+
*/
|
|
148
|
+
operator?: string | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* If provided, the generated stack trace omits frames before this function.
|
|
151
|
+
*/
|
|
152
|
+
stackStartFn?: Function | undefined;
|
|
153
|
+
/**
|
|
154
|
+
* If set to `'full'`, shows the full diff in assertion errors.
|
|
155
|
+
* @default 'simple'
|
|
156
|
+
*/
|
|
157
|
+
diff?: "simple" | "full" | undefined;
|
|
158
|
+
}
|
|
32
159
|
/**
|
|
33
160
|
* Indicates the failure of an assertion. All errors thrown by the `node:assert` module will be instances of the `AssertionError` class.
|
|
34
161
|
*/
|
|
35
162
|
class AssertionError extends Error {
|
|
163
|
+
constructor(options: AssertionErrorOptions);
|
|
36
164
|
/**
|
|
37
165
|
* Set to the `actual` argument for methods such as {@link assert.strictEqual()}.
|
|
38
166
|
*/
|
|
@@ -41,10 +169,6 @@ declare module "assert" {
|
|
|
41
169
|
* Set to the `expected` argument for methods such as {@link assert.strictEqual()}.
|
|
42
170
|
*/
|
|
43
171
|
expected: unknown;
|
|
44
|
-
/**
|
|
45
|
-
* Set to the passed in operator value.
|
|
46
|
-
*/
|
|
47
|
-
operator: string;
|
|
48
172
|
/**
|
|
49
173
|
* Indicates if the message was auto-generated (`true`) or not.
|
|
50
174
|
*/
|
|
@@ -53,19 +177,10 @@ declare module "assert" {
|
|
|
53
177
|
* Value is always `ERR_ASSERTION` to show that the error is an assertion error.
|
|
54
178
|
*/
|
|
55
179
|
code: "ERR_ASSERTION";
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
actual?: unknown | undefined;
|
|
61
|
-
/** The `expected` property on the error instance. */
|
|
62
|
-
expected?: unknown | undefined;
|
|
63
|
-
/** The `operator` property on the error instance. */
|
|
64
|
-
operator?: string | undefined;
|
|
65
|
-
/** If provided, the generated stack trace omits frames before this function. */
|
|
66
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
67
|
-
stackStartFn?: Function | undefined;
|
|
68
|
-
});
|
|
180
|
+
/**
|
|
181
|
+
* Set to the passed in operator value.
|
|
182
|
+
*/
|
|
183
|
+
operator: string;
|
|
69
184
|
}
|
|
70
185
|
/**
|
|
71
186
|
* This feature is deprecated and will be removed in a future version.
|
|
@@ -816,7 +931,7 @@ declare module "assert" {
|
|
|
816
931
|
* check that the promise is rejected.
|
|
817
932
|
*
|
|
818
933
|
* If `asyncFn` is a function and it throws an error synchronously, `assert.rejects()` will return a rejected `Promise` with that error. If the
|
|
819
|
-
* function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-
|
|
934
|
+
* function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v24.x/api/errors.html#err_invalid_return_value)
|
|
820
935
|
* error. In both cases the error handler is skipped.
|
|
821
936
|
*
|
|
822
937
|
* Besides the async nature to await the completion behaves identically to {@link throws}.
|
|
@@ -886,7 +1001,7 @@ declare module "assert" {
|
|
|
886
1001
|
*
|
|
887
1002
|
* If `asyncFn` is a function and it throws an error synchronously, `assert.doesNotReject()` will return a rejected `Promise` with that error. If
|
|
888
1003
|
* the function does not return a promise, `assert.doesNotReject()` will return a
|
|
889
|
-
* rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-
|
|
1004
|
+
* rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v24.x/api/errors.html#err_invalid_return_value) error. In both cases
|
|
890
1005
|
* the error handler is skipped.
|
|
891
1006
|
*
|
|
892
1007
|
* Using `assert.doesNotReject()` is actually not useful because there is little
|
|
@@ -949,7 +1064,7 @@ declare module "assert" {
|
|
|
949
1064
|
* If the values do not match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
|
|
950
1065
|
* to the value of the `message` parameter. If the `message` parameter is
|
|
951
1066
|
* undefined, a default error message is assigned. If the `message` parameter is an
|
|
952
|
-
* instance of an [Error](https://nodejs.org/docs/latest-
|
|
1067
|
+
* instance of an [Error](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
|
|
953
1068
|
* @since v13.6.0, v12.16.0
|
|
954
1069
|
*/
|
|
955
1070
|
function match(value: string, regExp: RegExp, message?: string | Error): void;
|
|
@@ -972,87 +1087,25 @@ declare module "assert" {
|
|
|
972
1087
|
* If the values do match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
|
|
973
1088
|
* to the value of the `message` parameter. If the `message` parameter is
|
|
974
1089
|
* undefined, a default error message is assigned. If the `message` parameter is an
|
|
975
|
-
* instance of an [Error](https://nodejs.org/docs/latest-
|
|
1090
|
+
* instance of an [Error](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
|
|
976
1091
|
* @since v13.6.0, v12.16.0
|
|
977
1092
|
*/
|
|
978
1093
|
function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
|
|
979
1094
|
/**
|
|
980
|
-
*
|
|
981
|
-
*
|
|
982
|
-
*
|
|
983
|
-
*
|
|
984
|
-
*
|
|
985
|
-
*
|
|
986
|
-
* To use strict assertion mode:
|
|
987
|
-
*
|
|
988
|
-
* ```js
|
|
989
|
-
* import { strict as assert } from 'node:assert';COPY
|
|
990
|
-
* import assert from 'node:assert/strict';
|
|
991
|
-
* ```
|
|
992
|
-
*
|
|
993
|
-
* Example error diff:
|
|
994
|
-
*
|
|
995
|
-
* ```js
|
|
996
|
-
* import { strict as assert } from 'node:assert';
|
|
997
|
-
*
|
|
998
|
-
* assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
|
|
999
|
-
* // AssertionError: Expected inputs to be strictly deep-equal:
|
|
1000
|
-
* // + actual - expected ... Lines skipped
|
|
1001
|
-
* //
|
|
1002
|
-
* // [
|
|
1003
|
-
* // [
|
|
1004
|
-
* // ...
|
|
1005
|
-
* // 2,
|
|
1006
|
-
* // + 3
|
|
1007
|
-
* // - '3'
|
|
1008
|
-
* // ],
|
|
1009
|
-
* // ...
|
|
1010
|
-
* // 5
|
|
1011
|
-
* // ]
|
|
1012
|
-
* ```
|
|
1013
|
-
*
|
|
1014
|
-
* To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS` environment variables. This will also
|
|
1015
|
-
* deactivate the colors in the REPL. For more on color support in terminal environments, read the tty
|
|
1016
|
-
* `getColorDepth()` documentation.
|
|
1095
|
+
* Tests for partial deep equality between the `actual` and `expected` parameters.
|
|
1096
|
+
* "Deep" equality means that the enumerable "own" properties of child objects
|
|
1097
|
+
* are recursively evaluated also by the following rules. "Partial" equality means
|
|
1098
|
+
* that only properties that exist on the `expected` parameter are going to be
|
|
1099
|
+
* compared.
|
|
1017
1100
|
*
|
|
1018
|
-
*
|
|
1101
|
+
* This method always passes the same test cases as `assert.deepStrictEqual()`,
|
|
1102
|
+
* behaving as a super set of it.
|
|
1103
|
+
* @since v22.13.0
|
|
1019
1104
|
*/
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
type CallTrackerReportInformation = assert.CallTrackerReportInformation;
|
|
1025
|
-
}
|
|
1026
|
-
const strict:
|
|
1027
|
-
& Omit<
|
|
1028
|
-
typeof assert,
|
|
1029
|
-
| "equal"
|
|
1030
|
-
| "notEqual"
|
|
1031
|
-
| "deepEqual"
|
|
1032
|
-
| "notDeepEqual"
|
|
1033
|
-
| "ok"
|
|
1034
|
-
| "strictEqual"
|
|
1035
|
-
| "deepStrictEqual"
|
|
1036
|
-
| "ifError"
|
|
1037
|
-
| "strict"
|
|
1038
|
-
| "AssertionError"
|
|
1039
|
-
>
|
|
1040
|
-
& {
|
|
1041
|
-
(value: unknown, message?: string | Error): asserts value;
|
|
1042
|
-
equal: typeof strictEqual;
|
|
1043
|
-
notEqual: typeof notStrictEqual;
|
|
1044
|
-
deepEqual: typeof deepStrictEqual;
|
|
1045
|
-
notDeepEqual: typeof notDeepStrictEqual;
|
|
1046
|
-
// Mapped types and assertion functions are incompatible?
|
|
1047
|
-
// TS2775: Assertions require every name in the call target
|
|
1048
|
-
// to be declared with an explicit type annotation.
|
|
1049
|
-
ok: typeof ok;
|
|
1050
|
-
strictEqual: typeof strictEqual;
|
|
1051
|
-
deepStrictEqual: typeof deepStrictEqual;
|
|
1052
|
-
ifError: typeof ifError;
|
|
1053
|
-
strict: typeof strict;
|
|
1054
|
-
AssertionError: typeof AssertionError;
|
|
1055
|
-
};
|
|
1105
|
+
function partialDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
|
1106
|
+
}
|
|
1107
|
+
namespace assert {
|
|
1108
|
+
export { strict };
|
|
1056
1109
|
}
|
|
1057
1110
|
export = assert;
|
|
1058
1111
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* We strongly discourage the use of the `async_hooks` API.
|
|
3
3
|
* Other APIs that can cover most of its use cases include:
|
|
4
4
|
*
|
|
5
|
-
* * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-
|
|
6
|
-
* * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-
|
|
5
|
+
* * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-v24.x/api/async_context.html#class-asynclocalstorage) tracks async context
|
|
6
|
+
* * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-v24.x/api/process.html#processgetactiveresourcesinfo) tracks active resources
|
|
7
7
|
*
|
|
8
8
|
* The `node:async_hooks` module provides an API to track asynchronous resources.
|
|
9
9
|
* It can be accessed using:
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* import async_hooks from 'node:async_hooks';
|
|
13
13
|
* ```
|
|
14
14
|
* @experimental
|
|
15
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
15
|
+
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/async_hooks.js)
|
|
16
16
|
*/
|
|
17
17
|
declare module "async_hooks" {
|
|
18
18
|
/**
|
|
@@ -44,7 +44,7 @@ declare module "async_hooks" {
|
|
|
44
44
|
* ```
|
|
45
45
|
*
|
|
46
46
|
* Promise contexts may not get precise `executionAsyncIds` by default.
|
|
47
|
-
* See the section on [promise execution tracking](https://nodejs.org/docs/latest-
|
|
47
|
+
* See the section on [promise execution tracking](https://nodejs.org/docs/latest-v24.x/api/async_hooks.html#promise-execution-tracking).
|
|
48
48
|
* @since v8.1.0
|
|
49
49
|
* @return The `asyncId` of the current execution context. Useful to track when something calls.
|
|
50
50
|
*/
|
|
@@ -77,7 +77,7 @@ declare module "async_hooks" {
|
|
|
77
77
|
* executionAsyncId,
|
|
78
78
|
* executionAsyncResource,
|
|
79
79
|
* createHook,
|
|
80
|
-
* } from 'async_hooks';
|
|
80
|
+
* } from 'node:async_hooks';
|
|
81
81
|
* const sym = Symbol('state'); // Private symbol to avoid pollution
|
|
82
82
|
*
|
|
83
83
|
* createHook({
|
|
@@ -117,7 +117,7 @@ declare module "async_hooks" {
|
|
|
117
117
|
* ```
|
|
118
118
|
*
|
|
119
119
|
* Promise contexts may not get valid `triggerAsyncId`s by default. See
|
|
120
|
-
* the section on [promise execution tracking](https://nodejs.org/docs/latest-
|
|
120
|
+
* the section on [promise execution tracking](https://nodejs.org/docs/latest-v24.x/api/async_hooks.html#promise-execution-tracking).
|
|
121
121
|
* @return The ID of the resource responsible for calling the callback that is currently being executed.
|
|
122
122
|
*/
|
|
123
123
|
function triggerAsyncId(): number;
|
|
@@ -320,6 +320,16 @@ declare module "async_hooks" {
|
|
|
320
320
|
*/
|
|
321
321
|
triggerAsyncId(): number;
|
|
322
322
|
}
|
|
323
|
+
interface AsyncLocalStorageOptions {
|
|
324
|
+
/**
|
|
325
|
+
* The default value to be used when no store is provided.
|
|
326
|
+
*/
|
|
327
|
+
defaultValue?: any;
|
|
328
|
+
/**
|
|
329
|
+
* A name for the `AsyncLocalStorage` value.
|
|
330
|
+
*/
|
|
331
|
+
name?: string | undefined;
|
|
332
|
+
}
|
|
323
333
|
/**
|
|
324
334
|
* This class creates stores that stay coherent through asynchronous operations.
|
|
325
335
|
*
|
|
@@ -358,8 +368,8 @@ declare module "async_hooks" {
|
|
|
358
368
|
* http.get('http://localhost:8080');
|
|
359
369
|
* // Prints:
|
|
360
370
|
* // 0: start
|
|
361
|
-
* // 1: start
|
|
362
371
|
* // 0: finish
|
|
372
|
+
* // 1: start
|
|
363
373
|
* // 1: finish
|
|
364
374
|
* ```
|
|
365
375
|
*
|
|
@@ -369,10 +379,14 @@ declare module "async_hooks" {
|
|
|
369
379
|
* @since v13.10.0, v12.17.0
|
|
370
380
|
*/
|
|
371
381
|
class AsyncLocalStorage<T> {
|
|
382
|
+
/**
|
|
383
|
+
* Creates a new instance of `AsyncLocalStorage`. Store is only provided within a
|
|
384
|
+
* `run()` call or after an `enterWith()` call.
|
|
385
|
+
*/
|
|
386
|
+
constructor(options?: AsyncLocalStorageOptions);
|
|
372
387
|
/**
|
|
373
388
|
* Binds the given function to the current execution context.
|
|
374
389
|
* @since v19.8.0
|
|
375
|
-
* @experimental
|
|
376
390
|
* @param fn The function to bind to the current execution context.
|
|
377
391
|
* @return A new function that calls `fn` within the captured execution context.
|
|
378
392
|
*/
|
|
@@ -403,7 +417,6 @@ declare module "async_hooks" {
|
|
|
403
417
|
* console.log(asyncLocalStorage.run(321, () => foo.get())); // returns 123
|
|
404
418
|
* ```
|
|
405
419
|
* @since v19.8.0
|
|
406
|
-
* @experimental
|
|
407
420
|
* @return A new function with the signature `(fn: (...args) : R, ...args) : R`.
|
|
408
421
|
*/
|
|
409
422
|
static snapshot(): <R, TArgs extends any[]>(fn: (...args: TArgs) => R, ...args: TArgs) => R;
|
|
@@ -432,6 +445,11 @@ declare module "async_hooks" {
|
|
|
432
445
|
* @since v13.10.0, v12.17.0
|
|
433
446
|
*/
|
|
434
447
|
getStore(): T | undefined;
|
|
448
|
+
/**
|
|
449
|
+
* The name of the `AsyncLocalStorage` instance if provided.
|
|
450
|
+
* @since v24.0.0
|
|
451
|
+
*/
|
|
452
|
+
readonly name: string;
|
|
435
453
|
/**
|
|
436
454
|
* Runs a function synchronously within a context and returns its
|
|
437
455
|
* return value. The store is not accessible outside of the callback function.
|
|
@@ -176,7 +176,8 @@ declare module "buffer" {
|
|
|
176
176
|
*
|
|
177
177
|
* If `totalLength` is provided, it is coerced to an unsigned integer. If the
|
|
178
178
|
* combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is
|
|
179
|
-
* truncated to `totalLength`.
|
|
179
|
+
* truncated to `totalLength`. If the combined length of the `Buffer`s in `list` is
|
|
180
|
+
* less than `totalLength`, the remaining space is filled with zeros.
|
|
180
181
|
*
|
|
181
182
|
* ```js
|
|
182
183
|
* import { Buffer } from 'node:buffer';
|
|
@@ -46,7 +46,7 @@ type _File = typeof globalThis extends { onmessage: any; File: any } ? {} : impo
|
|
|
46
46
|
* // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
|
|
47
47
|
* const buf7 = Buffer.from('tést', 'latin1');
|
|
48
48
|
* ```
|
|
49
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
49
|
+
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/buffer.js)
|
|
50
50
|
*/
|
|
51
51
|
declare module "buffer" {
|
|
52
52
|
import { BinaryLike } from "node:crypto";
|
|
@@ -122,7 +122,6 @@ declare module "buffer" {
|
|
|
122
122
|
* Resolves a `'blob:nodedata:...'` an associated `Blob` object registered using
|
|
123
123
|
* a prior call to `URL.createObjectURL()`.
|
|
124
124
|
* @since v16.7.0
|
|
125
|
-
* @experimental
|
|
126
125
|
* @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
|
|
127
126
|
*/
|
|
128
127
|
export function resolveObjectURL(id: string): Blob | undefined;
|
|
@@ -133,7 +132,7 @@ declare module "buffer" {
|
|
|
133
132
|
export interface BlobOptions {
|
|
134
133
|
/**
|
|
135
134
|
* One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts
|
|
136
|
-
* will be converted to the platform native line-ending as specified by `import { EOL } from 'node:
|
|
135
|
+
* will be converted to the platform native line-ending as specified by `import { EOL } from 'node:os'`.
|
|
137
136
|
*/
|
|
138
137
|
endings?: "transparent" | "native";
|
|
139
138
|
/**
|
|
@@ -144,7 +143,7 @@ declare module "buffer" {
|
|
|
144
143
|
type?: string | undefined;
|
|
145
144
|
}
|
|
146
145
|
/**
|
|
147
|
-
* A
|
|
146
|
+
* A `Blob` encapsulates immutable, raw data that can be safely shared across
|
|
148
147
|
* multiple worker threads.
|
|
149
148
|
* @since v15.7.0, v14.18.0
|
|
150
149
|
*/
|
|
@@ -183,7 +182,6 @@ declare module "buffer" {
|
|
|
183
182
|
* console.log(bytes); // Outputs: Uint8Array(5) [ 104, 101, 108, 108, 111 ]
|
|
184
183
|
* });
|
|
185
184
|
* ```
|
|
186
|
-
* @since v20.16.0
|
|
187
185
|
*/
|
|
188
186
|
bytes(): Promise<Uint8Array>;
|
|
189
187
|
/**
|
|
@@ -210,7 +208,7 @@ declare module "buffer" {
|
|
|
210
208
|
export interface FileOptions {
|
|
211
209
|
/**
|
|
212
210
|
* One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts will be
|
|
213
|
-
* converted to the platform native line-ending as specified by `import { EOL } from 'node:
|
|
211
|
+
* converted to the platform native line-ending as specified by `import { EOL } from 'node:os'`.
|
|
214
212
|
*/
|
|
215
213
|
endings?: "native" | "transparent";
|
|
216
214
|
/** The File content-type. */
|
|
@@ -1915,7 +1913,7 @@ declare module "buffer" {
|
|
|
1915
1913
|
function btoa(data: string): string;
|
|
1916
1914
|
interface Blob extends _Blob {}
|
|
1917
1915
|
/**
|
|
1918
|
-
* `Blob` class is a global reference for `import { Blob } from 'node:
|
|
1916
|
+
* `Blob` class is a global reference for `import { Blob } from 'node:buffer'`
|
|
1919
1917
|
* https://nodejs.org/api/buffer.html#class-blob
|
|
1920
1918
|
* @since v18.0.0
|
|
1921
1919
|
*/
|
|
@@ -1923,7 +1921,7 @@ declare module "buffer" {
|
|
|
1923
1921
|
: typeof import("buffer").Blob;
|
|
1924
1922
|
interface File extends _File {}
|
|
1925
1923
|
/**
|
|
1926
|
-
* `File` class is a global reference for `import { File } from 'node:
|
|
1924
|
+
* `File` class is a global reference for `import { File } from 'node:buffer'`
|
|
1927
1925
|
* https://nodejs.org/api/buffer.html#class-file
|
|
1928
1926
|
* @since v20.0.0
|
|
1929
1927
|
*/
|