@idlebox/stripe-node-types 24.0.14-patch.0 → 24.0.15
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.
- package/README.md +1 -1
- package/assert/strict.d.ts +113 -1
- package/assert.d.ts +162 -248
- package/async_hooks.d.ts +20 -5
- package/buffer.buffer.d.ts +24 -6
- package/buffer.d.ts +63 -168
- package/child_process.d.ts +117 -223
- package/cluster.d.ts +251 -329
- package/compatibility/iterators.d.ts +15 -0
- package/console.d.ts +60 -346
- package/constants.d.ts +15 -1
- package/crypto.d.ts +713 -1149
- package/dgram.d.ts +30 -50
- package/diagnostics_channel.d.ts +16 -3
- package/dns/promises.d.ts +15 -0
- package/dns.d.ts +150 -131
- package/domain.d.ts +25 -14
- package/events.d.ts +858 -719
- package/fs/promises.d.ts +117 -53
- package/fs.d.ts +729 -484
- package/globals.d.ts +142 -344
- package/globals.typedarray.d.ts +94 -0
- package/http.d.ts +358 -246
- package/http2.d.ts +578 -711
- package/https.d.ts +85 -216
- package/index.d.ts +39 -3
- package/inspector/promises.d.ts +54 -0
- package/inspector.d.ts +180 -3936
- package/inspector.generated.d.ts +4242 -0
- package/module.d.ts +60 -95
- package/my-shim.d.ts +15 -0
- package/net.d.ts +102 -186
- package/os.d.ts +32 -6
- package/package.json +3 -8
- package/path/posix.d.ts +20 -0
- package/path/win32.d.ts +20 -0
- package/path.d.ts +132 -122
- package/perf_hooks.d.ts +310 -644
- package/process.d.ts +192 -138
- package/punycode.d.ts +17 -2
- package/querystring.d.ts +16 -1
- package/quic.d.ts +926 -0
- package/readline/promises.d.ts +16 -1
- package/readline.d.ts +80 -118
- package/repl.d.ts +98 -96
- package/sea.d.ts +25 -1
- package/sqlite.d.ts +277 -13
- package/stream/consumers.d.ts +22 -7
- package/stream/promises.d.ts +148 -12
- package/stream/web.d.ts +187 -494
- package/stream.d.ts +608 -490
- package/string_decoder.d.ts +18 -3
- package/test/reporters.d.ts +112 -0
- package/test.d.ts +238 -199
- package/timers/promises.d.ts +16 -1
- package/timers.d.ts +16 -129
- package/tls.d.ts +163 -163
- package/trace_events.d.ts +21 -6
- package/ts5.6/buffer.buffer.d.ts +25 -8
- package/ts5.6/compatibility/float16array.d.ts +15 -0
- package/ts5.6/globals.typedarray.d.ts +31 -0
- package/ts5.6/index.d.ts +39 -3
- package/ts5.7/compatibility/float16array.d.ts +15 -0
- package/ts5.7/index.d.ts +39 -3
- package/tty.d.ts +70 -13
- package/undici-types/agent.d.ts +20 -4
- package/undici-types/api.d.ts +15 -0
- package/undici-types/balanced-pool.d.ts +15 -0
- package/undici-types/cache-interceptor.d.ts +15 -0
- package/undici-types/cache.d.ts +15 -0
- package/undici-types/client-stats.d.ts +31 -0
- package/undici-types/client.d.ts +21 -5
- package/undici-types/connector.d.ts +15 -0
- package/undici-types/content-type.d.ts +15 -0
- package/undici-types/cookies.d.ts +15 -0
- package/undici-types/diagnostics-channel.d.ts +24 -1
- package/undici-types/dispatcher.d.ts +18 -8
- package/undici-types/env-http-proxy-agent.d.ts +17 -1
- package/undici-types/errors.d.ts +20 -15
- package/undici-types/eventsource.d.ts +24 -4
- package/undici-types/fetch.d.ts +16 -0
- package/undici-types/formdata.d.ts +15 -0
- package/undici-types/global-dispatcher.d.ts +15 -0
- package/undici-types/global-origin.d.ts +15 -0
- package/undici-types/h2c-client.d.ts +15 -2
- package/undici-types/handlers.d.ts +16 -1
- package/undici-types/header.d.ts +15 -0
- package/undici-types/index.d.ts +21 -1
- package/undici-types/interceptors.d.ts +20 -0
- package/undici-types/mock-agent.d.ts +18 -0
- package/undici-types/mock-call-history.d.ts +15 -0
- package/undici-types/mock-client.d.ts +17 -0
- package/undici-types/mock-errors.d.ts +15 -0
- package/undici-types/mock-interceptor.d.ts +17 -1
- package/undici-types/mock-pool.d.ts +17 -0
- package/undici-types/package.json +1 -1
- package/undici-types/patch.d.ts +15 -0
- package/undici-types/pool-stats.d.ts +15 -0
- package/undici-types/pool.d.ts +17 -0
- package/undici-types/proxy-agent.d.ts +16 -0
- package/undici-types/readable.d.ts +15 -0
- package/undici-types/retry-agent.d.ts +15 -0
- package/undici-types/retry-handler.d.ts +24 -0
- package/undici-types/snapshot-agent.d.ts +125 -0
- package/undici-types/util.d.ts +15 -0
- package/undici-types/utility.d.ts +15 -0
- package/undici-types/webidl.d.ts +126 -36
- package/undici-types/websocket.d.ts +18 -1
- package/url.d.ts +107 -587
- package/util/types.d.ts +571 -0
- package/util.d.ts +158 -792
- package/v8.d.ts +82 -7
- package/vm.d.ts +267 -108
- package/wasi.d.ts +38 -2
- package/web-globals/abortcontroller.d.ts +75 -0
- package/web-globals/blob.d.ts +39 -0
- package/web-globals/console.d.ts +25 -0
- package/web-globals/crypto.d.ts +55 -0
- package/web-globals/domexception.d.ts +84 -0
- package/web-globals/encoding.d.ts +27 -0
- package/{dom-events.d.ts → web-globals/events.d.ts} +72 -50
- package/web-globals/fetch.d.ts +70 -0
- package/web-globals/importmeta.d.ts +29 -0
- package/web-globals/messaging.d.ts +39 -0
- package/web-globals/navigator.d.ts +41 -0
- package/web-globals/performance.d.ts +61 -0
- package/web-globals/storage.d.ts +40 -0
- package/web-globals/streams.d.ts +131 -0
- package/web-globals/timers.d.ts +60 -0
- package/web-globals/url.d.ts +40 -0
- package/worker_threads.d.ts +306 -349
- package/zlib.d.ts +59 -94
- package/ts5.1/compatibility/disposable.d.ts +0 -13
- package/ts5.1/index.d.ts +0 -100
package/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: Tue,
|
|
11
|
+
* Last updated: Tue, 13 Jan 2026 15:03:39 GMT
|
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
|
13
13
|
|
|
14
14
|
# Credits
|
package/assert/strict.d.ts
CHANGED
|
@@ -1,5 +1,117 @@
|
|
|
1
|
+
// biome-ignore-all lint: generated file
|
|
2
|
+
// biome-ignore-all assist: generated file
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
|
|
6
|
+
/******************************************************************************
|
|
7
|
+
* GENERATED FILE, DO NOT MODIFY
|
|
8
|
+
* 这是生成的文件,千万不要修改
|
|
9
|
+
*
|
|
10
|
+
* @build-script/codegen - The Simple Code Generater
|
|
11
|
+
* https://github.com/GongT/baobao
|
|
12
|
+
*
|
|
13
|
+
******************************************************************************/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* In strict assertion mode, non-strict methods behave like their corresponding
|
|
18
|
+
* strict methods. For example, `assert.deepEqual()` will behave like
|
|
19
|
+
* `assert.deepStrictEqual()`.
|
|
20
|
+
*
|
|
21
|
+
* In strict assertion mode, error messages for objects display a diff. In legacy
|
|
22
|
+
* assertion mode, error messages for objects display the objects, often truncated.
|
|
23
|
+
*
|
|
24
|
+
* To use strict assertion mode:
|
|
25
|
+
*
|
|
26
|
+
* ```js
|
|
27
|
+
* import { strict as assert } from 'node:assert';
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* ```js
|
|
31
|
+
* import assert from 'node:assert/strict';
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* Example error diff:
|
|
35
|
+
*
|
|
36
|
+
* ```js
|
|
37
|
+
* import { strict as assert } from 'node:assert';
|
|
38
|
+
*
|
|
39
|
+
* assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
|
|
40
|
+
* // AssertionError: Expected inputs to be strictly deep-equal:
|
|
41
|
+
* // + actual - expected ... Lines skipped
|
|
42
|
+
* //
|
|
43
|
+
* // [
|
|
44
|
+
* // [
|
|
45
|
+
* // ...
|
|
46
|
+
* // 2,
|
|
47
|
+
* // + 3
|
|
48
|
+
* // - '3'
|
|
49
|
+
* // ],
|
|
50
|
+
* // ...
|
|
51
|
+
* // 5
|
|
52
|
+
* // ]
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS`
|
|
56
|
+
* environment variables. This will also deactivate the colors in the REPL. For
|
|
57
|
+
* more on color support in terminal environments, read the tty
|
|
58
|
+
* [`getColorDepth()`](https://nodejs.org/docs/latest-v25.x/api/tty.html#writestreamgetcolordepthenv) documentation.
|
|
59
|
+
* @since v15.0.0
|
|
60
|
+
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/assert/strict.js)
|
|
61
|
+
*/
|
|
1
62
|
|
|
2
63
|
declare module "node:assert/strict" {
|
|
3
|
-
import {
|
|
64
|
+
import {
|
|
65
|
+
Assert,
|
|
66
|
+
AssertionError,
|
|
67
|
+
AssertionErrorOptions,
|
|
68
|
+
AssertOptions,
|
|
69
|
+
AssertPredicate,
|
|
70
|
+
AssertStrict,
|
|
71
|
+
deepStrictEqual,
|
|
72
|
+
doesNotMatch,
|
|
73
|
+
doesNotReject,
|
|
74
|
+
doesNotThrow,
|
|
75
|
+
fail,
|
|
76
|
+
ifError,
|
|
77
|
+
match,
|
|
78
|
+
notDeepStrictEqual,
|
|
79
|
+
notStrictEqual,
|
|
80
|
+
ok,
|
|
81
|
+
partialDeepStrictEqual,
|
|
82
|
+
rejects,
|
|
83
|
+
strictEqual,
|
|
84
|
+
throws,
|
|
85
|
+
} from 'node:assert';
|
|
86
|
+
function strict(value: unknown, message?: string | Error): asserts value;
|
|
87
|
+
namespace strict {
|
|
88
|
+
export {
|
|
89
|
+
Assert,
|
|
90
|
+
AssertionError,
|
|
91
|
+
AssertionErrorOptions,
|
|
92
|
+
AssertOptions,
|
|
93
|
+
AssertPredicate,
|
|
94
|
+
AssertStrict,
|
|
95
|
+
deepStrictEqual,
|
|
96
|
+
deepStrictEqual as deepEqual,
|
|
97
|
+
doesNotMatch,
|
|
98
|
+
doesNotReject,
|
|
99
|
+
doesNotThrow,
|
|
100
|
+
fail,
|
|
101
|
+
ifError,
|
|
102
|
+
match,
|
|
103
|
+
notDeepStrictEqual,
|
|
104
|
+
notDeepStrictEqual as notDeepEqual,
|
|
105
|
+
notStrictEqual,
|
|
106
|
+
notStrictEqual as notEqual,
|
|
107
|
+
ok,
|
|
108
|
+
partialDeepStrictEqual,
|
|
109
|
+
rejects,
|
|
110
|
+
strict,
|
|
111
|
+
strictEqual,
|
|
112
|
+
strictEqual as equal,
|
|
113
|
+
throws,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
4
116
|
export = strict;
|
|
5
117
|
}
|
package/assert.d.ts
CHANGED
|
@@ -1,202 +1,202 @@
|
|
|
1
|
+
// biome-ignore-all lint: generated file
|
|
2
|
+
// biome-ignore-all assist: generated file
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
|
|
6
|
+
/******************************************************************************
|
|
7
|
+
* GENERATED FILE, DO NOT MODIFY
|
|
8
|
+
* 这是生成的文件,千万不要修改
|
|
9
|
+
*
|
|
10
|
+
* @build-script/codegen - The Simple Code Generater
|
|
11
|
+
* https://github.com/GongT/baobao
|
|
12
|
+
*
|
|
13
|
+
******************************************************************************/
|
|
14
|
+
|
|
15
|
+
|
|
1
16
|
/**
|
|
2
17
|
* The `node:assert` module provides a set of assertion functions for verifying
|
|
3
18
|
* invariants.
|
|
4
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
19
|
+
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/assert.js)
|
|
5
20
|
*/
|
|
6
21
|
|
|
7
22
|
declare module "node:assert" {
|
|
23
|
+
import strict = require('node:assert/strict');
|
|
8
24
|
/**
|
|
9
|
-
* An alias of {@link ok}.
|
|
25
|
+
* An alias of {@link assert.ok}.
|
|
10
26
|
* @since v0.5.9
|
|
11
27
|
* @param value The input that is checked for being truthy.
|
|
12
28
|
*/
|
|
13
29
|
function assert(value: unknown, message?: string | Error): asserts value;
|
|
30
|
+
const kOptions: unique symbol;
|
|
14
31
|
namespace assert {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
type AssertMethodNames =
|
|
33
|
+
| "deepEqual"
|
|
34
|
+
| "deepStrictEqual"
|
|
35
|
+
| "doesNotMatch"
|
|
36
|
+
| "doesNotReject"
|
|
37
|
+
| "doesNotThrow"
|
|
38
|
+
| "equal"
|
|
39
|
+
| "fail"
|
|
40
|
+
| "ifError"
|
|
41
|
+
| "match"
|
|
42
|
+
| "notDeepEqual"
|
|
43
|
+
| "notDeepStrictEqual"
|
|
44
|
+
| "notEqual"
|
|
45
|
+
| "notStrictEqual"
|
|
46
|
+
| "ok"
|
|
47
|
+
| "partialDeepStrictEqual"
|
|
48
|
+
| "rejects"
|
|
49
|
+
| "strictEqual"
|
|
50
|
+
| "throws";
|
|
51
|
+
interface AssertOptions {
|
|
27
52
|
/**
|
|
28
|
-
*
|
|
53
|
+
* If set to `'full'`, shows the full diff in assertion errors.
|
|
54
|
+
* @default 'simple'
|
|
29
55
|
*/
|
|
30
|
-
|
|
56
|
+
diff?: "simple" | "full" | undefined;
|
|
31
57
|
/**
|
|
32
|
-
*
|
|
58
|
+
* If set to `true`, non-strict methods behave like their
|
|
59
|
+
* corresponding strict methods.
|
|
60
|
+
* @default true
|
|
33
61
|
*/
|
|
34
|
-
|
|
62
|
+
strict?: boolean | undefined;
|
|
35
63
|
/**
|
|
36
|
-
*
|
|
64
|
+
* If set to `true`, skips prototype and constructor
|
|
65
|
+
* comparison in deep equality checks.
|
|
66
|
+
* @since v24.9.0
|
|
67
|
+
* @default false
|
|
37
68
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
expected?: unknown | undefined;
|
|
46
|
-
/** The `operator` property on the error instance. */
|
|
47
|
-
operator?: string | undefined;
|
|
48
|
-
/** If provided, the generated stack trace omits frames before this function. */
|
|
49
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
50
|
-
stackStartFn?: Function | undefined;
|
|
51
|
-
});
|
|
69
|
+
skipPrototype?: boolean | undefined;
|
|
70
|
+
}
|
|
71
|
+
interface Assert extends Pick<typeof assert, AssertMethodNames> {
|
|
72
|
+
readonly [kOptions]: AssertOptions & { strict: false };
|
|
73
|
+
}
|
|
74
|
+
interface AssertStrict extends Pick<typeof strict, AssertMethodNames> {
|
|
75
|
+
readonly [kOptions]: AssertOptions & { strict: true };
|
|
52
76
|
}
|
|
53
77
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* @since v14.2.0, v12.19.0
|
|
57
|
-
* @deprecated Deprecated
|
|
78
|
+
* The `Assert` class allows creating independent assertion instances with custom options.
|
|
79
|
+
* @since v24.6.0
|
|
58
80
|
*/
|
|
59
|
-
|
|
81
|
+
var Assert: {
|
|
60
82
|
/**
|
|
61
|
-
* The
|
|
62
|
-
* function has not been called exactly `exact` times when `tracker.verify()` is called, then `tracker.verify()` will throw an
|
|
63
|
-
* error.
|
|
83
|
+
* Creates a new assertion instance. The `diff` option controls the verbosity of diffs in assertion error messages.
|
|
64
84
|
*
|
|
65
85
|
* ```js
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* function func() {}
|
|
72
|
-
*
|
|
73
|
-
* // Returns a function that wraps func() that must be called exact times
|
|
74
|
-
* // before tracker.verify().
|
|
75
|
-
* const callsfunc = tracker.calls(func);
|
|
86
|
+
* const { Assert } = require('node:assert');
|
|
87
|
+
* const assertInstance = new Assert({ diff: 'full' });
|
|
88
|
+
* assertInstance.deepStrictEqual({ a: 1 }, { a: 2 });
|
|
89
|
+
* // Shows a full diff in the error message.
|
|
76
90
|
* ```
|
|
77
|
-
* @since v14.2.0, v12.19.0
|
|
78
|
-
* @param [fn='A no-op function']
|
|
79
|
-
* @param [exact=1]
|
|
80
|
-
* @return A function that wraps `fn`.
|
|
81
|
-
*/
|
|
82
|
-
calls(exact?: number): () => void;
|
|
83
|
-
calls(fn: undefined, exact?: number): () => void;
|
|
84
|
-
calls<Func extends (...args: any[]) => any>(fn: Func, exact?: number): Func;
|
|
85
|
-
calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func | (() => void);
|
|
86
|
-
/**
|
|
87
|
-
* Example:
|
|
88
91
|
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
92
|
+
* **Important**: When destructuring assertion methods from an `Assert` instance,
|
|
93
|
+
* the methods lose their connection to the instance's configuration options (such
|
|
94
|
+
* as `diff`, `strict`, and `skipPrototype` settings).
|
|
95
|
+
* The destructured methods will fall back to default behavior instead.
|
|
91
96
|
*
|
|
92
|
-
*
|
|
97
|
+
* ```js
|
|
98
|
+
* const myAssert = new Assert({ diff: 'full' });
|
|
93
99
|
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* callsfunc(1, 2, 3);
|
|
100
|
+
* // This works as expected - uses 'full' diff
|
|
101
|
+
* myAssert.strictEqual({ a: 1 }, { b: { c: 1 } });
|
|
97
102
|
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
103
|
+
* // This loses the 'full' diff setting - falls back to default 'simple' diff
|
|
104
|
+
* const { strictEqual } = myAssert;
|
|
105
|
+
* strictEqual({ a: 1 }, { b: { c: 1 } });
|
|
100
106
|
* ```
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*/
|
|
104
|
-
getCalls(fn: Function): CallTrackerCall[];
|
|
105
|
-
/**
|
|
106
|
-
* The arrays contains information about the expected and actual number of calls of
|
|
107
|
-
* the functions that have not been called the expected number of times.
|
|
107
|
+
*
|
|
108
|
+
* The `skipPrototype` option affects all deep equality methods:
|
|
108
109
|
*
|
|
109
110
|
* ```js
|
|
110
|
-
*
|
|
111
|
+
* class Foo {
|
|
112
|
+
* constructor(a) {
|
|
113
|
+
* this.a = a;
|
|
114
|
+
* }
|
|
115
|
+
* }
|
|
111
116
|
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
117
|
+
* class Bar {
|
|
118
|
+
* constructor(a) {
|
|
119
|
+
* this.a = a;
|
|
120
|
+
* }
|
|
121
|
+
* }
|
|
114
122
|
*
|
|
115
|
-
*
|
|
123
|
+
* const foo = new Foo(1);
|
|
124
|
+
* const bar = new Bar(1);
|
|
116
125
|
*
|
|
117
|
-
* //
|
|
118
|
-
*
|
|
119
|
-
*
|
|
126
|
+
* // Default behavior - fails due to different constructors
|
|
127
|
+
* const assert1 = new Assert();
|
|
128
|
+
* assert1.deepStrictEqual(foo, bar); // AssertionError
|
|
120
129
|
*
|
|
121
|
-
* //
|
|
122
|
-
*
|
|
123
|
-
* //
|
|
124
|
-
* // {
|
|
125
|
-
* // message: 'Expected the func function to be executed 2 time(s) but was
|
|
126
|
-
* // executed 0 time(s).',
|
|
127
|
-
* // actual: 0,
|
|
128
|
-
* // expected: 2,
|
|
129
|
-
* // operator: 'func',
|
|
130
|
-
* // stack: stack trace
|
|
131
|
-
* // }
|
|
132
|
-
* // ]
|
|
130
|
+
* // Skip prototype comparison - passes if properties are equal
|
|
131
|
+
* const assert2 = new Assert({ skipPrototype: true });
|
|
132
|
+
* assert2.deepStrictEqual(foo, bar); // OK
|
|
133
133
|
* ```
|
|
134
|
-
*
|
|
135
|
-
*
|
|
134
|
+
*
|
|
135
|
+
* When destructured, methods lose access to the instance's `this` context and revert to default assertion behavior
|
|
136
|
+
* (diff: 'simple', non-strict mode).
|
|
137
|
+
* To maintain custom options when using destructured methods, avoid
|
|
138
|
+
* destructuring and call methods directly on the instance.
|
|
139
|
+
* @since v24.6.0
|
|
136
140
|
*/
|
|
137
|
-
|
|
141
|
+
new(
|
|
142
|
+
options?: AssertOptions & { strict?: true | undefined },
|
|
143
|
+
): AssertStrict;
|
|
144
|
+
new(
|
|
145
|
+
options: AssertOptions,
|
|
146
|
+
): Assert;
|
|
147
|
+
};
|
|
148
|
+
interface AssertionErrorOptions {
|
|
138
149
|
/**
|
|
139
|
-
*
|
|
140
|
-
* If no arguments are passed, all tracked functions will be reset.
|
|
141
|
-
*
|
|
142
|
-
* ```js
|
|
143
|
-
* import assert from 'node:assert';
|
|
144
|
-
*
|
|
145
|
-
* const tracker = new assert.CallTracker();
|
|
146
|
-
*
|
|
147
|
-
* function func() {}
|
|
148
|
-
* const callsfunc = tracker.calls(func);
|
|
149
|
-
*
|
|
150
|
-
* callsfunc();
|
|
151
|
-
* // Tracker was called once
|
|
152
|
-
* assert.strictEqual(tracker.getCalls(callsfunc).length, 1);
|
|
153
|
-
*
|
|
154
|
-
* tracker.reset(callsfunc);
|
|
155
|
-
* assert.strictEqual(tracker.getCalls(callsfunc).length, 0);
|
|
156
|
-
* ```
|
|
157
|
-
* @since v18.8.0, v16.18.0
|
|
158
|
-
* @param fn a tracked function to reset.
|
|
150
|
+
* If provided, the error message is set to this value.
|
|
159
151
|
*/
|
|
160
|
-
|
|
152
|
+
message?: string | undefined;
|
|
161
153
|
/**
|
|
162
|
-
*
|
|
163
|
-
* have not been called the expected number of times.
|
|
164
|
-
*
|
|
165
|
-
* ```js
|
|
166
|
-
* import assert from 'node:assert';
|
|
167
|
-
*
|
|
168
|
-
* // Creates call tracker.
|
|
169
|
-
* const tracker = new assert.CallTracker();
|
|
170
|
-
*
|
|
171
|
-
* function func() {}
|
|
172
|
-
*
|
|
173
|
-
* // Returns a function that wraps func() that must be called exact times
|
|
174
|
-
* // before tracker.verify().
|
|
175
|
-
* const callsfunc = tracker.calls(func, 2);
|
|
176
|
-
*
|
|
177
|
-
* callsfunc();
|
|
178
|
-
*
|
|
179
|
-
* // Will throw an error since callsfunc() was only called once.
|
|
180
|
-
* tracker.verify();
|
|
181
|
-
* ```
|
|
182
|
-
* @since v14.2.0, v12.19.0
|
|
154
|
+
* The `actual` property on the error instance.
|
|
183
155
|
*/
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
156
|
+
actual?: unknown;
|
|
157
|
+
/**
|
|
158
|
+
* The `expected` property on the error instance.
|
|
159
|
+
*/
|
|
160
|
+
expected?: unknown;
|
|
161
|
+
/**
|
|
162
|
+
* The `operator` property on the error instance.
|
|
163
|
+
*/
|
|
164
|
+
operator?: string | undefined;
|
|
165
|
+
/**
|
|
166
|
+
* If provided, the generated stack trace omits frames before this function.
|
|
167
|
+
*/
|
|
168
|
+
stackStartFn?: Function | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* If set to `'full'`, shows the full diff in assertion errors.
|
|
171
|
+
* @default 'simple'
|
|
172
|
+
*/
|
|
173
|
+
diff?: "simple" | "full" | undefined;
|
|
189
174
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
175
|
+
/**
|
|
176
|
+
* Indicates the failure of an assertion. All errors thrown by the `node:assert` module will be instances of the `AssertionError` class.
|
|
177
|
+
*/
|
|
178
|
+
class AssertionError extends Error {
|
|
179
|
+
constructor(options: AssertionErrorOptions);
|
|
180
|
+
/**
|
|
181
|
+
* Set to the `actual` argument for methods such as {@link assert.strictEqual()}.
|
|
182
|
+
*/
|
|
183
|
+
actual: unknown;
|
|
184
|
+
/**
|
|
185
|
+
* Set to the `expected` argument for methods such as {@link assert.strictEqual()}.
|
|
186
|
+
*/
|
|
187
|
+
expected: unknown;
|
|
188
|
+
/**
|
|
189
|
+
* Indicates if the message was auto-generated (`true`) or not.
|
|
190
|
+
*/
|
|
191
|
+
generatedMessage: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Value is always `ERR_ASSERTION` to show that the error is an assertion error.
|
|
194
|
+
*/
|
|
195
|
+
code: "ERR_ASSERTION";
|
|
196
|
+
/**
|
|
197
|
+
* Set to the passed in operator value.
|
|
198
|
+
*/
|
|
197
199
|
operator: string;
|
|
198
|
-
/** A stack trace of the function. */
|
|
199
|
-
stack: object;
|
|
200
200
|
}
|
|
201
201
|
type AssertPredicate = RegExp | (new() => object) | ((thrown: unknown) => boolean) | object | Error;
|
|
202
202
|
/**
|
|
@@ -216,22 +216,10 @@ declare module "node:assert" {
|
|
|
216
216
|
* assert.fail(new TypeError('need array'));
|
|
217
217
|
* // TypeError: need array
|
|
218
218
|
* ```
|
|
219
|
-
*
|
|
220
|
-
* Using `assert.fail()` with more than two arguments is possible but deprecated.
|
|
221
|
-
* See below for further details.
|
|
222
219
|
* @since v0.1.21
|
|
223
220
|
* @param [message='Failed']
|
|
224
221
|
*/
|
|
225
222
|
function fail(message?: string | Error): never;
|
|
226
|
-
/** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
|
|
227
|
-
function fail(
|
|
228
|
-
actual: unknown,
|
|
229
|
-
expected: unknown,
|
|
230
|
-
message?: string | Error,
|
|
231
|
-
operator?: string,
|
|
232
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
233
|
-
stackStartFn?: Function,
|
|
234
|
-
): never;
|
|
235
223
|
/**
|
|
236
224
|
* Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`.
|
|
237
225
|
*
|
|
@@ -799,7 +787,7 @@ declare module "node:assert" {
|
|
|
799
787
|
* check that the promise is rejected.
|
|
800
788
|
*
|
|
801
789
|
* If `asyncFn` is a function and it throws an error synchronously, `assert.rejects()` will return a rejected `Promise` with that error. If the
|
|
802
|
-
* function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-
|
|
790
|
+
* function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v25.x/api/errors.html#err_invalid_return_value)
|
|
803
791
|
* error. In both cases the error handler is skipped.
|
|
804
792
|
*
|
|
805
793
|
* Besides the async nature to await the completion behaves identically to {@link throws}.
|
|
@@ -869,7 +857,7 @@ declare module "node:assert" {
|
|
|
869
857
|
*
|
|
870
858
|
* If `asyncFn` is a function and it throws an error synchronously, `assert.doesNotReject()` will return a rejected `Promise` with that error. If
|
|
871
859
|
* the function does not return a promise, `assert.doesNotReject()` will return a
|
|
872
|
-
* rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-
|
|
860
|
+
* rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v25.x/api/errors.html#err_invalid_return_value) error. In both cases
|
|
873
861
|
* the error handler is skipped.
|
|
874
862
|
*
|
|
875
863
|
* Using `assert.doesNotReject()` is actually not useful because there is little
|
|
@@ -932,7 +920,7 @@ declare module "node:assert" {
|
|
|
932
920
|
* 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
|
|
933
921
|
* to the value of the `message` parameter. If the `message` parameter is
|
|
934
922
|
* undefined, a default error message is assigned. If the `message` parameter is an
|
|
935
|
-
* instance of an [Error](https://nodejs.org/docs/latest-
|
|
923
|
+
* instance of an [Error](https://nodejs.org/docs/latest-v25.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
|
|
936
924
|
* @since v13.6.0, v12.16.0
|
|
937
925
|
*/
|
|
938
926
|
function match(value: string, regExp: RegExp, message?: string | Error): void;
|
|
@@ -955,7 +943,7 @@ declare module "node:assert" {
|
|
|
955
943
|
* 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
|
|
956
944
|
* to the value of the `message` parameter. If the `message` parameter is
|
|
957
945
|
* undefined, a default error message is assigned. If the `message` parameter is an
|
|
958
|
-
* instance of an [Error](https://nodejs.org/docs/latest-
|
|
946
|
+
* instance of an [Error](https://nodejs.org/docs/latest-v25.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
|
|
959
947
|
* @since v13.6.0, v12.16.0
|
|
960
948
|
*/
|
|
961
949
|
function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
|
|
@@ -971,83 +959,9 @@ declare module "node:assert" {
|
|
|
971
959
|
* @since v22.13.0
|
|
972
960
|
*/
|
|
973
961
|
function partialDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
*
|
|
978
|
-
* In strict assertion mode, error messages for objects display a diff. In legacy assertion mode, error
|
|
979
|
-
* messages for objects display the objects, often truncated.
|
|
980
|
-
*
|
|
981
|
-
* To use strict assertion mode:
|
|
982
|
-
*
|
|
983
|
-
* ```js
|
|
984
|
-
* import { strict as assert } from 'node:assert';
|
|
985
|
-
* import assert from 'node:assert/strict';
|
|
986
|
-
* ```
|
|
987
|
-
*
|
|
988
|
-
* Example error diff:
|
|
989
|
-
*
|
|
990
|
-
* ```js
|
|
991
|
-
* import { strict as assert } from 'node:assert';
|
|
992
|
-
*
|
|
993
|
-
* assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
|
|
994
|
-
* // AssertionError: Expected inputs to be strictly deep-equal:
|
|
995
|
-
* // + actual - expected ... Lines skipped
|
|
996
|
-
* //
|
|
997
|
-
* // [
|
|
998
|
-
* // [
|
|
999
|
-
* // ...
|
|
1000
|
-
* // 2,
|
|
1001
|
-
* // + 3
|
|
1002
|
-
* // - '3'
|
|
1003
|
-
* // ],
|
|
1004
|
-
* // ...
|
|
1005
|
-
* // 5
|
|
1006
|
-
* // ]
|
|
1007
|
-
* ```
|
|
1008
|
-
*
|
|
1009
|
-
* To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS` environment variables. This will also
|
|
1010
|
-
* deactivate the colors in the REPL. For more on color support in terminal environments, read the tty
|
|
1011
|
-
* `getColorDepth()` documentation.
|
|
1012
|
-
*
|
|
1013
|
-
* @since v15.0.0, v13.9.0, v12.16.2, v9.9.0
|
|
1014
|
-
*/
|
|
1015
|
-
namespace strict {
|
|
1016
|
-
type AssertionError = assert.AssertionError;
|
|
1017
|
-
type AssertPredicate = assert.AssertPredicate;
|
|
1018
|
-
type CallTrackerCall = assert.CallTrackerCall;
|
|
1019
|
-
type CallTrackerReportInformation = assert.CallTrackerReportInformation;
|
|
1020
|
-
}
|
|
1021
|
-
const strict:
|
|
1022
|
-
& Omit<
|
|
1023
|
-
typeof assert,
|
|
1024
|
-
| "equal"
|
|
1025
|
-
| "notEqual"
|
|
1026
|
-
| "deepEqual"
|
|
1027
|
-
| "notDeepEqual"
|
|
1028
|
-
| "ok"
|
|
1029
|
-
| "strictEqual"
|
|
1030
|
-
| "deepStrictEqual"
|
|
1031
|
-
| "ifError"
|
|
1032
|
-
| "strict"
|
|
1033
|
-
| "AssertionError"
|
|
1034
|
-
>
|
|
1035
|
-
& {
|
|
1036
|
-
(value: unknown, message?: string | Error): asserts value;
|
|
1037
|
-
equal: typeof strictEqual;
|
|
1038
|
-
notEqual: typeof notStrictEqual;
|
|
1039
|
-
deepEqual: typeof deepStrictEqual;
|
|
1040
|
-
notDeepEqual: typeof notDeepStrictEqual;
|
|
1041
|
-
// Mapped types and assertion functions are incompatible?
|
|
1042
|
-
// TS2775: Assertions require every name in the call target
|
|
1043
|
-
// to be declared with an explicit type annotation.
|
|
1044
|
-
ok: typeof ok;
|
|
1045
|
-
strictEqual: typeof strictEqual;
|
|
1046
|
-
deepStrictEqual: typeof deepStrictEqual;
|
|
1047
|
-
ifError: typeof ifError;
|
|
1048
|
-
strict: typeof strict;
|
|
1049
|
-
AssertionError: typeof AssertionError;
|
|
1050
|
-
};
|
|
962
|
+
}
|
|
963
|
+
namespace assert {
|
|
964
|
+
export { strict };
|
|
1051
965
|
}
|
|
1052
966
|
export = assert;
|
|
1053
967
|
}
|