cdk-common 2.0.1289 → 2.0.1291
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/.jsii +2 -2
- package/lib/main.js +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/assert/strict.d.ts +105 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/assert.d.ts +119 -95
- package/node_modules/@types/concat-stream/node_modules/@types/node/crypto.d.ts +117 -7
- package/node_modules/@types/concat-stream/node_modules/@types/node/events.d.ts +79 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/fs.d.ts +224 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/http.d.ts +28 -3
- package/node_modules/@types/concat-stream/node_modules/@types/node/package.json +3 -3
- package/node_modules/@types/concat-stream/node_modules/@types/node/test.d.ts +2 -23
- package/node_modules/@types/concat-stream/node_modules/@types/node/util.d.ts +5 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/events.d.ts +3 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/worker_threads.d.ts +33 -47
- package/node_modules/@types/concat-stream/node_modules/@types/node/zlib.d.ts +6 -0
- package/node_modules/@types/concat-stream/node_modules/undici-types/agent.d.ts +0 -4
- package/node_modules/@types/concat-stream/node_modules/undici-types/client.d.ts +0 -2
- package/node_modules/@types/concat-stream/node_modules/undici-types/dispatcher.d.ts +0 -6
- package/node_modules/@types/concat-stream/node_modules/undici-types/h2c-client.d.ts +0 -2
- package/node_modules/@types/concat-stream/node_modules/undici-types/index.d.ts +3 -1
- package/node_modules/@types/concat-stream/node_modules/undici-types/mock-interceptor.d.ts +0 -1
- package/node_modules/@types/concat-stream/node_modules/undici-types/package.json +1 -1
- package/node_modules/@types/concat-stream/node_modules/undici-types/snapshot-agent.d.ts +107 -0
- package/node_modules/@types/form-data/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/assert/strict.d.ts +105 -2
- package/node_modules/@types/form-data/node_modules/@types/node/assert.d.ts +119 -95
- package/node_modules/@types/form-data/node_modules/@types/node/crypto.d.ts +117 -7
- package/node_modules/@types/form-data/node_modules/@types/node/events.d.ts +79 -0
- package/node_modules/@types/form-data/node_modules/@types/node/fs.d.ts +224 -0
- package/node_modules/@types/form-data/node_modules/@types/node/http.d.ts +28 -3
- package/node_modules/@types/form-data/node_modules/@types/node/package.json +3 -3
- package/node_modules/@types/form-data/node_modules/@types/node/test.d.ts +2 -23
- package/node_modules/@types/form-data/node_modules/@types/node/util.d.ts +5 -0
- package/node_modules/@types/form-data/node_modules/@types/node/web-globals/events.d.ts +3 -0
- package/node_modules/@types/form-data/node_modules/@types/node/worker_threads.d.ts +33 -47
- package/node_modules/@types/form-data/node_modules/@types/node/zlib.d.ts +6 -0
- package/node_modules/@types/form-data/node_modules/undici-types/agent.d.ts +0 -4
- package/node_modules/@types/form-data/node_modules/undici-types/client.d.ts +0 -2
- package/node_modules/@types/form-data/node_modules/undici-types/dispatcher.d.ts +0 -6
- package/node_modules/@types/form-data/node_modules/undici-types/h2c-client.d.ts +0 -2
- package/node_modules/@types/form-data/node_modules/undici-types/index.d.ts +3 -1
- package/node_modules/@types/form-data/node_modules/undici-types/mock-interceptor.d.ts +0 -1
- package/node_modules/@types/form-data/node_modules/undici-types/package.json +1 -1
- package/node_modules/@types/form-data/node_modules/undici-types/snapshot-agent.d.ts +107 -0
- package/node_modules/async-function/.eslintrc +16 -0
- package/node_modules/async-function/.github/FUNDING.yml +12 -0
- package/node_modules/async-function/.nycrc +9 -0
- package/node_modules/async-function/CHANGELOG.md +16 -0
- package/node_modules/async-function/LICENSE +21 -0
- package/node_modules/async-function/README.md +51 -0
- package/node_modules/async-function/index.d.mts +3 -0
- package/node_modules/async-function/index.d.ts +13 -0
- package/node_modules/async-function/index.js +8 -0
- package/node_modules/async-function/index.mjs +4 -0
- package/node_modules/async-function/legacy.js +18 -0
- package/node_modules/async-function/package.json +86 -0
- package/node_modules/async-function/require.mjs +5 -0
- package/node_modules/async-function/test/index.js +40 -0
- package/node_modules/async-function/tsconfig.json +9 -0
- package/node_modules/async-generator-function/.eslintrc +26 -0
- package/node_modules/async-generator-function/.github/FUNDING.yml +12 -0
- package/node_modules/async-generator-function/.nycrc +9 -0
- package/node_modules/async-generator-function/CHANGELOG.md +15 -0
- package/node_modules/async-generator-function/LICENSE +21 -0
- package/node_modules/async-generator-function/README.md +52 -0
- package/node_modules/async-generator-function/index.d.mts +3 -0
- package/node_modules/async-generator-function/index.d.ts +22 -0
- package/node_modules/async-generator-function/index.js +8 -0
- package/node_modules/async-generator-function/index.mjs +4 -0
- package/node_modules/async-generator-function/legacy.js +18 -0
- package/node_modules/async-generator-function/package.json +87 -0
- package/node_modules/async-generator-function/require.mjs +5 -0
- package/node_modules/async-generator-function/test/index.js +40 -0
- package/node_modules/async-generator-function/tsconfig.json +9 -0
- package/node_modules/generator-function/.eslintrc +16 -0
- package/node_modules/generator-function/.github/FUNDING.yml +12 -0
- package/node_modules/generator-function/.nycrc +9 -0
- package/node_modules/generator-function/CHANGELOG.md +21 -0
- package/node_modules/generator-function/LICENSE.md +7 -0
- package/node_modules/generator-function/README.md +51 -0
- package/node_modules/generator-function/index.d.mts +3 -0
- package/node_modules/generator-function/index.d.ts +3 -0
- package/node_modules/generator-function/index.js +8 -0
- package/node_modules/generator-function/index.mjs +4 -0
- package/node_modules/generator-function/legacy.js +18 -0
- package/node_modules/generator-function/package.json +88 -0
- package/node_modules/generator-function/require.mjs +5 -0
- package/node_modules/generator-function/test/index.js +42 -0
- package/node_modules/generator-function/tsconfig.json +9 -0
- package/node_modules/get-intrinsic/CHANGELOG.md +7 -0
- package/node_modules/get-intrinsic/index.js +8 -13
- package/node_modules/get-intrinsic/package.json +7 -4
- package/package.json +3 -3
|
@@ -51,8 +51,6 @@ export declare namespace H2CClient {
|
|
|
51
51
|
/** TODO */
|
|
52
52
|
maxCachedSessions?: number;
|
|
53
53
|
/** TODO */
|
|
54
|
-
maxRedirections?: number;
|
|
55
|
-
/** TODO */
|
|
56
54
|
connect?: Omit<Partial<buildConnector.BuildOptions>, 'allowH2'> | buildConnector.connector;
|
|
57
55
|
/** TODO */
|
|
58
56
|
maxRequestsPerClient?: number;
|
|
@@ -13,6 +13,7 @@ import Agent from './agent'
|
|
|
13
13
|
import MockClient from './mock-client'
|
|
14
14
|
import MockPool from './mock-pool'
|
|
15
15
|
import MockAgent from './mock-agent'
|
|
16
|
+
import { SnapshotAgent } from './snapshot-agent'
|
|
16
17
|
import { MockCallHistory, MockCallHistoryLog } from './mock-call-history'
|
|
17
18
|
import mockErrors from './mock-errors'
|
|
18
19
|
import ProxyAgent from './proxy-agent'
|
|
@@ -33,7 +34,7 @@ export * from './content-type'
|
|
|
33
34
|
export * from './cache'
|
|
34
35
|
export { Interceptable } from './mock-interceptor'
|
|
35
36
|
|
|
36
|
-
export { Dispatcher, BalancedPool, Pool, Client, buildConnector, errors, Agent, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, interceptors, MockClient, MockPool, MockAgent, MockCallHistory, MockCallHistoryLog, mockErrors, ProxyAgent, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent, H2CClient }
|
|
37
|
+
export { Dispatcher, BalancedPool, Pool, Client, buildConnector, errors, Agent, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, interceptors, MockClient, MockPool, MockAgent, SnapshotAgent, MockCallHistory, MockCallHistoryLog, mockErrors, ProxyAgent, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent, H2CClient }
|
|
37
38
|
export default Undici
|
|
38
39
|
|
|
39
40
|
declare namespace Undici {
|
|
@@ -58,6 +59,7 @@ declare namespace Undici {
|
|
|
58
59
|
const MockClient: typeof import('./mock-client').default
|
|
59
60
|
const MockPool: typeof import('./mock-pool').default
|
|
60
61
|
const MockAgent: typeof import('./mock-agent').default
|
|
62
|
+
const SnapshotAgent: typeof import('./snapshot-agent').SnapshotAgent
|
|
61
63
|
const MockCallHistory: typeof import('./mock-call-history').MockCallHistory
|
|
62
64
|
const MockCallHistoryLog: typeof import('./mock-call-history').MockCallHistoryLog
|
|
63
65
|
const mockErrors: typeof import('./mock-errors').default
|
|
@@ -69,7 +69,6 @@ declare namespace MockInterceptor {
|
|
|
69
69
|
headers?: Headers | Record<string, string>;
|
|
70
70
|
origin?: string;
|
|
71
71
|
body?: BodyInit | Dispatcher.DispatchOptions['body'] | null;
|
|
72
|
-
maxRedirections?: number;
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
export type MockResponseDataHandler<TData extends object = object> = (
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import MockAgent from './mock-agent'
|
|
2
|
+
|
|
3
|
+
declare class SnapshotRecorder {
|
|
4
|
+
constructor (options?: SnapshotRecorder.Options)
|
|
5
|
+
|
|
6
|
+
record (requestOpts: any, response: any): Promise<void>
|
|
7
|
+
findSnapshot (requestOpts: any): SnapshotRecorder.Snapshot | undefined
|
|
8
|
+
loadSnapshots (filePath?: string): Promise<void>
|
|
9
|
+
saveSnapshots (filePath?: string): Promise<void>
|
|
10
|
+
clear (): void
|
|
11
|
+
getSnapshots (): SnapshotRecorder.Snapshot[]
|
|
12
|
+
size (): number
|
|
13
|
+
resetCallCounts (): void
|
|
14
|
+
deleteSnapshot (requestOpts: any): boolean
|
|
15
|
+
getSnapshotInfo (requestOpts: any): SnapshotRecorder.SnapshotInfo | null
|
|
16
|
+
replaceSnapshots (snapshotData: SnapshotRecorder.SnapshotData[]): void
|
|
17
|
+
destroy (): void
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare namespace SnapshotRecorder {
|
|
21
|
+
export interface Options {
|
|
22
|
+
snapshotPath?: string
|
|
23
|
+
mode?: 'record' | 'playback' | 'update'
|
|
24
|
+
maxSnapshots?: number
|
|
25
|
+
autoFlush?: boolean
|
|
26
|
+
flushInterval?: number
|
|
27
|
+
matchHeaders?: string[]
|
|
28
|
+
ignoreHeaders?: string[]
|
|
29
|
+
excludeHeaders?: string[]
|
|
30
|
+
matchBody?: boolean
|
|
31
|
+
matchQuery?: boolean
|
|
32
|
+
caseSensitive?: boolean
|
|
33
|
+
shouldRecord?: (requestOpts: any) => boolean
|
|
34
|
+
shouldPlayback?: (requestOpts: any) => boolean
|
|
35
|
+
excludeUrls?: (string | RegExp)[]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface Snapshot {
|
|
39
|
+
request: {
|
|
40
|
+
method: string
|
|
41
|
+
url: string
|
|
42
|
+
headers: Record<string, string>
|
|
43
|
+
body?: string
|
|
44
|
+
}
|
|
45
|
+
responses: {
|
|
46
|
+
statusCode: number
|
|
47
|
+
headers: Record<string, string>
|
|
48
|
+
body: string
|
|
49
|
+
trailers: Record<string, string>
|
|
50
|
+
}[]
|
|
51
|
+
callCount: number
|
|
52
|
+
timestamp: string
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface SnapshotInfo {
|
|
56
|
+
hash: string
|
|
57
|
+
request: {
|
|
58
|
+
method: string
|
|
59
|
+
url: string
|
|
60
|
+
headers: Record<string, string>
|
|
61
|
+
body?: string
|
|
62
|
+
}
|
|
63
|
+
responseCount: number
|
|
64
|
+
callCount: number
|
|
65
|
+
timestamp: string
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface SnapshotData {
|
|
69
|
+
hash: string
|
|
70
|
+
snapshot: Snapshot
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare class SnapshotAgent extends MockAgent {
|
|
75
|
+
constructor (options?: SnapshotAgent.Options)
|
|
76
|
+
|
|
77
|
+
saveSnapshots (filePath?: string): Promise<void>
|
|
78
|
+
loadSnapshots (filePath?: string): Promise<void>
|
|
79
|
+
getRecorder (): SnapshotRecorder
|
|
80
|
+
getMode (): 'record' | 'playback' | 'update'
|
|
81
|
+
clearSnapshots (): void
|
|
82
|
+
resetCallCounts (): void
|
|
83
|
+
deleteSnapshot (requestOpts: any): boolean
|
|
84
|
+
getSnapshotInfo (requestOpts: any): SnapshotRecorder.SnapshotInfo | null
|
|
85
|
+
replaceSnapshots (snapshotData: SnapshotRecorder.SnapshotData[]): void
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
declare namespace SnapshotAgent {
|
|
89
|
+
export interface Options extends MockAgent.Options {
|
|
90
|
+
mode?: 'record' | 'playback' | 'update'
|
|
91
|
+
snapshotPath?: string
|
|
92
|
+
maxSnapshots?: number
|
|
93
|
+
autoFlush?: boolean
|
|
94
|
+
flushInterval?: number
|
|
95
|
+
matchHeaders?: string[]
|
|
96
|
+
ignoreHeaders?: string[]
|
|
97
|
+
excludeHeaders?: string[]
|
|
98
|
+
matchBody?: boolean
|
|
99
|
+
matchQuery?: boolean
|
|
100
|
+
caseSensitive?: boolean
|
|
101
|
+
shouldRecord?: (requestOpts: any) => boolean
|
|
102
|
+
shouldPlayback?: (requestOpts: any) => boolean
|
|
103
|
+
excludeUrls?: (string | RegExp)[]
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export { SnapshotAgent, SnapshotRecorder }
|
|
@@ -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:
|
|
11
|
+
* Last updated: Mon, 29 Sep 2025 18:40:16 GMT
|
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
|
13
13
|
|
|
14
14
|
# Credits
|
|
@@ -1,8 +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
|
+
*/
|
|
1
47
|
declare module "assert/strict" {
|
|
2
|
-
import {
|
|
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
|
+
}
|
|
3
106
|
export = strict;
|
|
4
107
|
}
|
|
5
108
|
declare module "node:assert/strict" {
|
|
6
|
-
import
|
|
109
|
+
import strict = require("assert/strict");
|
|
7
110
|
export = strict;
|
|
8
111
|
}
|
|
@@ -4,17 +4,128 @@
|
|
|
4
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 {
|
|
16
|
+
type AssertMethodNames =
|
|
17
|
+
| "deepEqual"
|
|
18
|
+
| "deepStrictEqual"
|
|
19
|
+
| "doesNotMatch"
|
|
20
|
+
| "doesNotReject"
|
|
21
|
+
| "doesNotThrow"
|
|
22
|
+
| "equal"
|
|
23
|
+
| "fail"
|
|
24
|
+
| "ifError"
|
|
25
|
+
| "match"
|
|
26
|
+
| "notDeepEqual"
|
|
27
|
+
| "notDeepStrictEqual"
|
|
28
|
+
| "notEqual"
|
|
29
|
+
| "notStrictEqual"
|
|
30
|
+
| "ok"
|
|
31
|
+
| "partialDeepStrictEqual"
|
|
32
|
+
| "rejects"
|
|
33
|
+
| "strictEqual"
|
|
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
|
+
interface Assert extends Pick<typeof assert, AssertMethodNames> {
|
|
49
|
+
readonly [kOptions]: AssertOptions & { strict: false };
|
|
50
|
+
}
|
|
51
|
+
interface AssertStrict extends Pick<typeof strict, AssertMethodNames> {
|
|
52
|
+
readonly [kOptions]: AssertOptions & { strict: true };
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The `Assert` class allows creating independent assertion instances with custom options.
|
|
56
|
+
* @since v24.6.0
|
|
57
|
+
*/
|
|
58
|
+
var Assert: {
|
|
59
|
+
/**
|
|
60
|
+
* Creates a new assertion instance. The `diff` option controls the verbosity of diffs in assertion error messages.
|
|
61
|
+
*
|
|
62
|
+
* ```js
|
|
63
|
+
* const { Assert } = require('node:assert');
|
|
64
|
+
* const assertInstance = new Assert({ diff: 'full' });
|
|
65
|
+
* assertInstance.deepStrictEqual({ a: 1 }, { a: 2 });
|
|
66
|
+
* // Shows a full diff in the error message.
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* **Important**: When destructuring assertion methods from an `Assert` instance,
|
|
70
|
+
* the methods lose their connection to the instance's configuration options (such as `diff` and `strict` settings).
|
|
71
|
+
* The destructured methods will fall back to default behavior instead.
|
|
72
|
+
*
|
|
73
|
+
* ```js
|
|
74
|
+
* const myAssert = new Assert({ diff: 'full' });
|
|
75
|
+
*
|
|
76
|
+
* // This works as expected - uses 'full' diff
|
|
77
|
+
* myAssert.strictEqual({ a: 1 }, { b: { c: 1 } });
|
|
78
|
+
*
|
|
79
|
+
* // This loses the 'full' diff setting - falls back to default 'simple' diff
|
|
80
|
+
* const { strictEqual } = myAssert;
|
|
81
|
+
* strictEqual({ a: 1 }, { b: { c: 1 } });
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* When destructured, methods lose access to the instance's `this` context and revert to default assertion behavior
|
|
85
|
+
* (diff: 'simple', non-strict mode).
|
|
86
|
+
* To maintain custom options when using destructured methods, avoid
|
|
87
|
+
* destructuring and call methods directly on the instance.
|
|
88
|
+
* @since v24.6.0
|
|
89
|
+
*/
|
|
90
|
+
new(
|
|
91
|
+
options?: AssertOptions & { strict?: true },
|
|
92
|
+
): AssertStrict;
|
|
93
|
+
new(
|
|
94
|
+
options: AssertOptions,
|
|
95
|
+
): Assert;
|
|
96
|
+
};
|
|
97
|
+
interface AssertionErrorOptions {
|
|
98
|
+
/**
|
|
99
|
+
* If provided, the error message is set to this value.
|
|
100
|
+
*/
|
|
101
|
+
message?: string | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* The `actual` property on the error instance.
|
|
104
|
+
*/
|
|
105
|
+
actual?: unknown;
|
|
106
|
+
/**
|
|
107
|
+
* The `expected` property on the error instance.
|
|
108
|
+
*/
|
|
109
|
+
expected?: unknown;
|
|
110
|
+
/**
|
|
111
|
+
* The `operator` property on the error instance.
|
|
112
|
+
*/
|
|
113
|
+
operator?: string | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* If provided, the generated stack trace omits frames before this function.
|
|
116
|
+
*/
|
|
117
|
+
stackStartFn?: Function | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* If set to `'full'`, shows the full diff in assertion errors.
|
|
120
|
+
* @default 'simple'
|
|
121
|
+
*/
|
|
122
|
+
diff?: "simple" | "full" | undefined;
|
|
123
|
+
}
|
|
14
124
|
/**
|
|
15
125
|
* Indicates the failure of an assertion. All errors thrown by the `node:assert` module will be instances of the `AssertionError` class.
|
|
16
126
|
*/
|
|
17
127
|
class AssertionError extends Error {
|
|
128
|
+
constructor(options: AssertionErrorOptions);
|
|
18
129
|
/**
|
|
19
130
|
* Set to the `actual` argument for methods such as {@link assert.strictEqual()}.
|
|
20
131
|
*/
|
|
@@ -23,10 +134,6 @@ declare module "assert" {
|
|
|
23
134
|
* Set to the `expected` argument for methods such as {@link assert.strictEqual()}.
|
|
24
135
|
*/
|
|
25
136
|
expected: unknown;
|
|
26
|
-
/**
|
|
27
|
-
* Set to the passed in operator value.
|
|
28
|
-
*/
|
|
29
|
-
operator: string;
|
|
30
137
|
/**
|
|
31
138
|
* Indicates if the message was auto-generated (`true`) or not.
|
|
32
139
|
*/
|
|
@@ -35,19 +142,10 @@ declare module "assert" {
|
|
|
35
142
|
* Value is always `ERR_ASSERTION` to show that the error is an assertion error.
|
|
36
143
|
*/
|
|
37
144
|
code: "ERR_ASSERTION";
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
actual?: unknown | undefined;
|
|
43
|
-
/** The `expected` property on the error instance. */
|
|
44
|
-
expected?: unknown | undefined;
|
|
45
|
-
/** The `operator` property on the error instance. */
|
|
46
|
-
operator?: string | undefined;
|
|
47
|
-
/** If provided, the generated stack trace omits frames before this function. */
|
|
48
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
49
|
-
stackStartFn?: Function | undefined;
|
|
50
|
-
});
|
|
145
|
+
/**
|
|
146
|
+
* Set to the passed in operator value.
|
|
147
|
+
*/
|
|
148
|
+
operator: string;
|
|
51
149
|
}
|
|
52
150
|
/**
|
|
53
151
|
* This feature is deprecated and will be removed in a future version.
|
|
@@ -970,83 +1068,9 @@ declare module "assert" {
|
|
|
970
1068
|
* @since v22.13.0
|
|
971
1069
|
*/
|
|
972
1070
|
function partialDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
*
|
|
977
|
-
* In strict assertion mode, error messages for objects display a diff. In legacy assertion mode, error
|
|
978
|
-
* messages for objects display the objects, often truncated.
|
|
979
|
-
*
|
|
980
|
-
* To use strict assertion mode:
|
|
981
|
-
*
|
|
982
|
-
* ```js
|
|
983
|
-
* import { strict as assert } from 'node:assert';
|
|
984
|
-
* import assert from 'node:assert/strict';
|
|
985
|
-
* ```
|
|
986
|
-
*
|
|
987
|
-
* Example error diff:
|
|
988
|
-
*
|
|
989
|
-
* ```js
|
|
990
|
-
* import { strict as assert } from 'node:assert';
|
|
991
|
-
*
|
|
992
|
-
* assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
|
|
993
|
-
* // AssertionError: Expected inputs to be strictly deep-equal:
|
|
994
|
-
* // + actual - expected ... Lines skipped
|
|
995
|
-
* //
|
|
996
|
-
* // [
|
|
997
|
-
* // [
|
|
998
|
-
* // ...
|
|
999
|
-
* // 2,
|
|
1000
|
-
* // + 3
|
|
1001
|
-
* // - '3'
|
|
1002
|
-
* // ],
|
|
1003
|
-
* // ...
|
|
1004
|
-
* // 5
|
|
1005
|
-
* // ]
|
|
1006
|
-
* ```
|
|
1007
|
-
*
|
|
1008
|
-
* To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS` environment variables. This will also
|
|
1009
|
-
* deactivate the colors in the REPL. For more on color support in terminal environments, read the tty
|
|
1010
|
-
* `getColorDepth()` documentation.
|
|
1011
|
-
*
|
|
1012
|
-
* @since v15.0.0, v13.9.0, v12.16.2, v9.9.0
|
|
1013
|
-
*/
|
|
1014
|
-
namespace strict {
|
|
1015
|
-
type AssertionError = assert.AssertionError;
|
|
1016
|
-
type AssertPredicate = assert.AssertPredicate;
|
|
1017
|
-
type CallTrackerCall = assert.CallTrackerCall;
|
|
1018
|
-
type CallTrackerReportInformation = assert.CallTrackerReportInformation;
|
|
1019
|
-
}
|
|
1020
|
-
const strict:
|
|
1021
|
-
& Omit<
|
|
1022
|
-
typeof assert,
|
|
1023
|
-
| "equal"
|
|
1024
|
-
| "notEqual"
|
|
1025
|
-
| "deepEqual"
|
|
1026
|
-
| "notDeepEqual"
|
|
1027
|
-
| "ok"
|
|
1028
|
-
| "strictEqual"
|
|
1029
|
-
| "deepStrictEqual"
|
|
1030
|
-
| "ifError"
|
|
1031
|
-
| "strict"
|
|
1032
|
-
| "AssertionError"
|
|
1033
|
-
>
|
|
1034
|
-
& {
|
|
1035
|
-
(value: unknown, message?: string | Error): asserts value;
|
|
1036
|
-
equal: typeof strictEqual;
|
|
1037
|
-
notEqual: typeof notStrictEqual;
|
|
1038
|
-
deepEqual: typeof deepStrictEqual;
|
|
1039
|
-
notDeepEqual: typeof notDeepStrictEqual;
|
|
1040
|
-
// Mapped types and assertion functions are incompatible?
|
|
1041
|
-
// TS2775: Assertions require every name in the call target
|
|
1042
|
-
// to be declared with an explicit type annotation.
|
|
1043
|
-
ok: typeof ok;
|
|
1044
|
-
strictEqual: typeof strictEqual;
|
|
1045
|
-
deepStrictEqual: typeof deepStrictEqual;
|
|
1046
|
-
ifError: typeof ifError;
|
|
1047
|
-
strict: typeof strict;
|
|
1048
|
-
AssertionError: typeof AssertionError;
|
|
1049
|
-
};
|
|
1071
|
+
}
|
|
1072
|
+
namespace assert {
|
|
1073
|
+
export { strict };
|
|
1050
1074
|
}
|
|
1051
1075
|
export = assert;
|
|
1052
1076
|
}
|