rahad-all-downloader 2.1.16 → 2.1.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. package/.github/workflows/Run.yml +20 -0
  2. package/README.md +0 -1
  3. package/index.js +1 -1
  4. package/package.json +4 -2
  5. package/.cache/nix/binary-cache-v6.sqlite +0 -0
  6. package/.cache/nix/binary-cache-v6.sqlite-journal +0 -0
  7. package/.cache/replit/env/latest +0 -123
  8. package/.cache/replit/env/latest.json +0 -1
  9. package/.cache/replit/modules/nix.res +0 -1
  10. package/.cache/replit/modules/nodejs-20.res +0 -1
  11. package/.cache/replit/modules/replit.res +0 -1
  12. package/.cache/replit/modules.stamp +0 -0
  13. package/.cache/replit/nix/env.json +0 -1
  14. package/.cache/typescript/5.4/node_modules/.package-lock.json +0 -137
  15. package/.cache/typescript/5.4/node_modules/@types/caseless/LICENSE +0 -21
  16. package/.cache/typescript/5.4/node_modules/@types/caseless/README.md +0 -48
  17. package/.cache/typescript/5.4/node_modules/@types/caseless/index.d.ts +0 -29
  18. package/.cache/typescript/5.4/node_modules/@types/caseless/package.json +0 -35
  19. package/.cache/typescript/5.4/node_modules/@types/node/LICENSE +0 -21
  20. package/.cache/typescript/5.4/node_modules/@types/node/README.md +0 -15
  21. package/.cache/typescript/5.4/node_modules/@types/node/assert/strict.d.ts +0 -8
  22. package/.cache/typescript/5.4/node_modules/@types/node/assert.d.ts +0 -1040
  23. package/.cache/typescript/5.4/node_modules/@types/node/async_hooks.d.ts +0 -541
  24. package/.cache/typescript/5.4/node_modules/@types/node/buffer.d.ts +0 -2363
  25. package/.cache/typescript/5.4/node_modules/@types/node/child_process.d.ts +0 -1544
  26. package/.cache/typescript/5.4/node_modules/@types/node/cluster.d.ts +0 -578
  27. package/.cache/typescript/5.4/node_modules/@types/node/console.d.ts +0 -452
  28. package/.cache/typescript/5.4/node_modules/@types/node/constants.d.ts +0 -19
  29. package/.cache/typescript/5.4/node_modules/@types/node/crypto.d.ts +0 -4523
  30. package/.cache/typescript/5.4/node_modules/@types/node/dgram.d.ts +0 -596
  31. package/.cache/typescript/5.4/node_modules/@types/node/diagnostics_channel.d.ts +0 -554
  32. package/.cache/typescript/5.4/node_modules/@types/node/dns/promises.d.ts +0 -474
  33. package/.cache/typescript/5.4/node_modules/@types/node/dns.d.ts +0 -864
  34. package/.cache/typescript/5.4/node_modules/@types/node/dom-events.d.ts +0 -124
  35. package/.cache/typescript/5.4/node_modules/@types/node/domain.d.ts +0 -170
  36. package/.cache/typescript/5.4/node_modules/@types/node/events.d.ts +0 -909
  37. package/.cache/typescript/5.4/node_modules/@types/node/fs/promises.d.ts +0 -1245
  38. package/.cache/typescript/5.4/node_modules/@types/node/fs.d.ts +0 -4317
  39. package/.cache/typescript/5.4/node_modules/@types/node/globals.d.ts +0 -411
  40. package/.cache/typescript/5.4/node_modules/@types/node/globals.global.d.ts +0 -1
  41. package/.cache/typescript/5.4/node_modules/@types/node/http.d.ts +0 -1908
  42. package/.cache/typescript/5.4/node_modules/@types/node/http2.d.ts +0 -2418
  43. package/.cache/typescript/5.4/node_modules/@types/node/https.d.ts +0 -550
  44. package/.cache/typescript/5.4/node_modules/@types/node/index.d.ts +0 -89
  45. package/.cache/typescript/5.4/node_modules/@types/node/inspector.d.ts +0 -2746
  46. package/.cache/typescript/5.4/node_modules/@types/node/module.d.ts +0 -315
  47. package/.cache/typescript/5.4/node_modules/@types/node/net.d.ts +0 -999
  48. package/.cache/typescript/5.4/node_modules/@types/node/os.d.ts +0 -495
  49. package/.cache/typescript/5.4/node_modules/@types/node/package.json +0 -217
  50. package/.cache/typescript/5.4/node_modules/@types/node/path.d.ts +0 -191
  51. package/.cache/typescript/5.4/node_modules/@types/node/perf_hooks.d.ts +0 -905
  52. package/.cache/typescript/5.4/node_modules/@types/node/process.d.ts +0 -1754
  53. package/.cache/typescript/5.4/node_modules/@types/node/punycode.d.ts +0 -117
  54. package/.cache/typescript/5.4/node_modules/@types/node/querystring.d.ts +0 -153
  55. package/.cache/typescript/5.4/node_modules/@types/node/readline/promises.d.ts +0 -150
  56. package/.cache/typescript/5.4/node_modules/@types/node/readline.d.ts +0 -540
  57. package/.cache/typescript/5.4/node_modules/@types/node/repl.d.ts +0 -430
  58. package/.cache/typescript/5.4/node_modules/@types/node/sea.d.ts +0 -153
  59. package/.cache/typescript/5.4/node_modules/@types/node/stream/consumers.d.ts +0 -12
  60. package/.cache/typescript/5.4/node_modules/@types/node/stream/promises.d.ts +0 -83
  61. package/.cache/typescript/5.4/node_modules/@types/node/stream/web.d.ts +0 -367
  62. package/.cache/typescript/5.4/node_modules/@types/node/stream.d.ts +0 -1707
  63. package/.cache/typescript/5.4/node_modules/@types/node/string_decoder.d.ts +0 -67
  64. package/.cache/typescript/5.4/node_modules/@types/node/test.d.ts +0 -1718
  65. package/.cache/typescript/5.4/node_modules/@types/node/timers/promises.d.ts +0 -97
  66. package/.cache/typescript/5.4/node_modules/@types/node/timers.d.ts +0 -240
  67. package/.cache/typescript/5.4/node_modules/@types/node/tls.d.ts +0 -1217
  68. package/.cache/typescript/5.4/node_modules/@types/node/trace_events.d.ts +0 -197
  69. package/.cache/typescript/5.4/node_modules/@types/node/tty.d.ts +0 -208
  70. package/.cache/typescript/5.4/node_modules/@types/node/url.d.ts +0 -952
  71. package/.cache/typescript/5.4/node_modules/@types/node/util.d.ts +0 -2292
  72. package/.cache/typescript/5.4/node_modules/@types/node/v8.d.ts +0 -808
  73. package/.cache/typescript/5.4/node_modules/@types/node/vm.d.ts +0 -924
  74. package/.cache/typescript/5.4/node_modules/@types/node/wasi.d.ts +0 -181
  75. package/.cache/typescript/5.4/node_modules/@types/node/worker_threads.d.ts +0 -691
  76. package/.cache/typescript/5.4/node_modules/@types/node/zlib.d.ts +0 -530
  77. package/.cache/typescript/5.4/node_modules/@types/node-fetch/LICENSE +0 -21
  78. package/.cache/typescript/5.4/node_modules/@types/node-fetch/README.md +0 -15
  79. package/.cache/typescript/5.4/node_modules/@types/node-fetch/externals.d.ts +0 -32
  80. package/.cache/typescript/5.4/node_modules/@types/node-fetch/index.d.ts +0 -238
  81. package/.cache/typescript/5.4/node_modules/@types/node-fetch/package.json +0 -83
  82. package/.cache/typescript/5.4/node_modules/@types/request/LICENSE +0 -21
  83. package/.cache/typescript/5.4/node_modules/@types/request/README.md +0 -15
  84. package/.cache/typescript/5.4/node_modules/@types/request/index.d.ts +0 -395
  85. package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/License +0 -19
  86. package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/README.md +0 -350
  87. package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/README.md.bak +0 -350
  88. package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/index.d.ts +0 -51
  89. package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/lib/browser.js +0 -2
  90. package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/lib/form_data.js +0 -483
  91. package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/lib/populate.js +0 -10
  92. package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/package.json +0 -68
  93. package/.cache/typescript/5.4/node_modules/@types/request/package.json +0 -70
  94. package/.cache/typescript/5.4/node_modules/@types/tough-cookie/LICENSE +0 -21
  95. package/.cache/typescript/5.4/node_modules/@types/tough-cookie/README.md +0 -15
  96. package/.cache/typescript/5.4/node_modules/@types/tough-cookie/index.d.ts +0 -321
  97. package/.cache/typescript/5.4/node_modules/@types/tough-cookie/package.json +0 -35
  98. package/.cache/typescript/5.4/node_modules/asynckit/LICENSE +0 -21
  99. package/.cache/typescript/5.4/node_modules/asynckit/README.md +0 -233
  100. package/.cache/typescript/5.4/node_modules/asynckit/bench.js +0 -76
  101. package/.cache/typescript/5.4/node_modules/asynckit/index.js +0 -6
  102. package/.cache/typescript/5.4/node_modules/asynckit/lib/abort.js +0 -29
  103. package/.cache/typescript/5.4/node_modules/asynckit/lib/async.js +0 -34
  104. package/.cache/typescript/5.4/node_modules/asynckit/lib/defer.js +0 -26
  105. package/.cache/typescript/5.4/node_modules/asynckit/lib/iterate.js +0 -75
  106. package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_asynckit.js +0 -91
  107. package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_parallel.js +0 -25
  108. package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_serial.js +0 -25
  109. package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_serial_ordered.js +0 -29
  110. package/.cache/typescript/5.4/node_modules/asynckit/lib/state.js +0 -37
  111. package/.cache/typescript/5.4/node_modules/asynckit/lib/streamify.js +0 -141
  112. package/.cache/typescript/5.4/node_modules/asynckit/lib/terminator.js +0 -29
  113. package/.cache/typescript/5.4/node_modules/asynckit/package.json +0 -63
  114. package/.cache/typescript/5.4/node_modules/asynckit/parallel.js +0 -43
  115. package/.cache/typescript/5.4/node_modules/asynckit/serial.js +0 -17
  116. package/.cache/typescript/5.4/node_modules/asynckit/serialOrdered.js +0 -75
  117. package/.cache/typescript/5.4/node_modules/asynckit/stream.js +0 -21
  118. package/.cache/typescript/5.4/node_modules/combined-stream/License +0 -19
  119. package/.cache/typescript/5.4/node_modules/combined-stream/Readme.md +0 -138
  120. package/.cache/typescript/5.4/node_modules/combined-stream/lib/combined_stream.js +0 -208
  121. package/.cache/typescript/5.4/node_modules/combined-stream/package.json +0 -25
  122. package/.cache/typescript/5.4/node_modules/combined-stream/yarn.lock +0 -17
  123. package/.cache/typescript/5.4/node_modules/delayed-stream/License +0 -19
  124. package/.cache/typescript/5.4/node_modules/delayed-stream/Makefile +0 -7
  125. package/.cache/typescript/5.4/node_modules/delayed-stream/Readme.md +0 -141
  126. package/.cache/typescript/5.4/node_modules/delayed-stream/lib/delayed_stream.js +0 -107
  127. package/.cache/typescript/5.4/node_modules/delayed-stream/package.json +0 -27
  128. package/.cache/typescript/5.4/node_modules/form-data/License +0 -19
  129. package/.cache/typescript/5.4/node_modules/form-data/README.md.bak +0 -358
  130. package/.cache/typescript/5.4/node_modules/form-data/Readme.md +0 -358
  131. package/.cache/typescript/5.4/node_modules/form-data/index.d.ts +0 -62
  132. package/.cache/typescript/5.4/node_modules/form-data/lib/browser.js +0 -2
  133. package/.cache/typescript/5.4/node_modules/form-data/lib/form_data.js +0 -501
  134. package/.cache/typescript/5.4/node_modules/form-data/lib/populate.js +0 -10
  135. package/.cache/typescript/5.4/node_modules/form-data/package.json +0 -68
  136. package/.cache/typescript/5.4/node_modules/mime-db/HISTORY.md +0 -507
  137. package/.cache/typescript/5.4/node_modules/mime-db/LICENSE +0 -23
  138. package/.cache/typescript/5.4/node_modules/mime-db/README.md +0 -100
  139. package/.cache/typescript/5.4/node_modules/mime-db/db.json +0 -8519
  140. package/.cache/typescript/5.4/node_modules/mime-db/index.js +0 -12
  141. package/.cache/typescript/5.4/node_modules/mime-db/package.json +0 -60
  142. package/.cache/typescript/5.4/node_modules/mime-types/HISTORY.md +0 -397
  143. package/.cache/typescript/5.4/node_modules/mime-types/LICENSE +0 -23
  144. package/.cache/typescript/5.4/node_modules/mime-types/README.md +0 -113
  145. package/.cache/typescript/5.4/node_modules/mime-types/index.js +0 -188
  146. package/.cache/typescript/5.4/node_modules/mime-types/package.json +0 -44
  147. package/.cache/typescript/5.4/node_modules/types-registry/README.md +0 -2
  148. package/.cache/typescript/5.4/node_modules/types-registry/index.json +0 -1
  149. package/.cache/typescript/5.4/node_modules/types-registry/package.json +0 -20
  150. package/.cache/typescript/5.4/node_modules/undici-types/README.md +0 -6
  151. package/.cache/typescript/5.4/node_modules/undici-types/agent.d.ts +0 -31
  152. package/.cache/typescript/5.4/node_modules/undici-types/api.d.ts +0 -43
  153. package/.cache/typescript/5.4/node_modules/undici-types/balanced-pool.d.ts +0 -18
  154. package/.cache/typescript/5.4/node_modules/undici-types/cache.d.ts +0 -36
  155. package/.cache/typescript/5.4/node_modules/undici-types/client.d.ts +0 -97
  156. package/.cache/typescript/5.4/node_modules/undici-types/connector.d.ts +0 -34
  157. package/.cache/typescript/5.4/node_modules/undici-types/content-type.d.ts +0 -21
  158. package/.cache/typescript/5.4/node_modules/undici-types/cookies.d.ts +0 -28
  159. package/.cache/typescript/5.4/node_modules/undici-types/diagnostics-channel.d.ts +0 -67
  160. package/.cache/typescript/5.4/node_modules/undici-types/dispatcher.d.ts +0 -241
  161. package/.cache/typescript/5.4/node_modules/undici-types/errors.d.ts +0 -128
  162. package/.cache/typescript/5.4/node_modules/undici-types/fetch.d.ts +0 -209
  163. package/.cache/typescript/5.4/node_modules/undici-types/file.d.ts +0 -39
  164. package/.cache/typescript/5.4/node_modules/undici-types/filereader.d.ts +0 -54
  165. package/.cache/typescript/5.4/node_modules/undici-types/formdata.d.ts +0 -108
  166. package/.cache/typescript/5.4/node_modules/undici-types/global-dispatcher.d.ts +0 -9
  167. package/.cache/typescript/5.4/node_modules/undici-types/global-origin.d.ts +0 -7
  168. package/.cache/typescript/5.4/node_modules/undici-types/handlers.d.ts +0 -9
  169. package/.cache/typescript/5.4/node_modules/undici-types/header.d.ts +0 -4
  170. package/.cache/typescript/5.4/node_modules/undici-types/index.d.ts +0 -63
  171. package/.cache/typescript/5.4/node_modules/undici-types/interceptors.d.ts +0 -5
  172. package/.cache/typescript/5.4/node_modules/undici-types/mock-agent.d.ts +0 -50
  173. package/.cache/typescript/5.4/node_modules/undici-types/mock-client.d.ts +0 -25
  174. package/.cache/typescript/5.4/node_modules/undici-types/mock-errors.d.ts +0 -12
  175. package/.cache/typescript/5.4/node_modules/undici-types/mock-interceptor.d.ts +0 -93
  176. package/.cache/typescript/5.4/node_modules/undici-types/mock-pool.d.ts +0 -25
  177. package/.cache/typescript/5.4/node_modules/undici-types/package.json +0 -55
  178. package/.cache/typescript/5.4/node_modules/undici-types/patch.d.ts +0 -71
  179. package/.cache/typescript/5.4/node_modules/undici-types/pool-stats.d.ts +0 -19
  180. package/.cache/typescript/5.4/node_modules/undici-types/pool.d.ts +0 -28
  181. package/.cache/typescript/5.4/node_modules/undici-types/proxy-agent.d.ts +0 -30
  182. package/.cache/typescript/5.4/node_modules/undici-types/readable.d.ts +0 -61
  183. package/.cache/typescript/5.4/node_modules/undici-types/webidl.d.ts +0 -220
  184. package/.cache/typescript/5.4/node_modules/undici-types/websocket.d.ts +0 -131
  185. package/.cache/typescript/5.4/package-lock.json +0 -146
  186. package/.cache/typescript/5.4/package.json +0 -1
  187. package/.replit +0 -21
  188. package/replit.nix +0 -3
@@ -1,1040 +0,0 @@
1
- /**
2
- * The `node:assert` module provides a set of assertion functions for verifying
3
- * invariants.
4
- * @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/assert.js)
5
- */
6
- declare module "assert" {
7
- /**
8
- * An alias of {@link ok}.
9
- * @since v0.5.9
10
- * @param value The input that is checked for being truthy.
11
- */
12
- function assert(value: unknown, message?: string | Error): asserts value;
13
- namespace assert {
14
- /**
15
- * Indicates the failure of an assertion. All errors thrown by the `node:assert` module will be instances of the `AssertionError` class.
16
- */
17
- class AssertionError extends Error {
18
- /**
19
- * Set to the `actual` argument for methods such as {@link assert.strictEqual()}.
20
- */
21
- actual: unknown;
22
- /**
23
- * Set to the `expected` argument for methods such as {@link assert.strictEqual()}.
24
- */
25
- expected: unknown;
26
- /**
27
- * Set to the passed in operator value.
28
- */
29
- operator: string;
30
- /**
31
- * Indicates if the message was auto-generated (`true`) or not.
32
- */
33
- generatedMessage: boolean;
34
- /**
35
- * Value is always `ERR_ASSERTION` to show that the error is an assertion error.
36
- */
37
- code: "ERR_ASSERTION";
38
- constructor(options?: {
39
- /** If provided, the error message is set to this value. */
40
- message?: string | undefined;
41
- /** The `actual` property on the error instance. */
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/ban-types
49
- stackStartFn?: Function | undefined;
50
- });
51
- }
52
- /**
53
- * This feature is deprecated and will be removed in a future version.
54
- * Please consider using alternatives such as the `mock` helper function.
55
- * @since v14.2.0, v12.19.0
56
- * @deprecated Deprecated
57
- */
58
- class CallTracker {
59
- /**
60
- * The wrapper function is expected to be called exactly `exact` times. If the
61
- * function has not been called exactly `exact` times when `tracker.verify()` is called, then `tracker.verify()` will throw an
62
- * error.
63
- *
64
- * ```js
65
- * import assert from 'node:assert';
66
- *
67
- * // Creates call tracker.
68
- * const tracker = new assert.CallTracker();
69
- *
70
- * function func() {}
71
- *
72
- * // Returns a function that wraps func() that must be called exact times
73
- * // before tracker.verify().
74
- * const callsfunc = tracker.calls(func);
75
- * ```
76
- * @since v14.2.0, v12.19.0
77
- * @param [fn='A no-op function']
78
- * @param [exact=1]
79
- * @return A function that wraps `fn`.
80
- */
81
- calls(exact?: number): () => void;
82
- calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
83
- /**
84
- * Example:
85
- *
86
- * ```js
87
- * import assert from 'node:assert';
88
- *
89
- * const tracker = new assert.CallTracker();
90
- *
91
- * function func() {}
92
- * const callsfunc = tracker.calls(func);
93
- * callsfunc(1, 2, 3);
94
- *
95
- * assert.deepStrictEqual(tracker.getCalls(callsfunc),
96
- * [{ thisArg: undefined, arguments: [1, 2, 3] }]);
97
- * ```
98
- * @since v18.8.0, v16.18.0
99
- * @return An array with all the calls to a tracked function.
100
- */
101
- getCalls(fn: Function): CallTrackerCall[];
102
- /**
103
- * The arrays contains information about the expected and actual number of calls of
104
- * the functions that have not been called the expected number of times.
105
- *
106
- * ```js
107
- * import assert from 'node:assert';
108
- *
109
- * // Creates call tracker.
110
- * const tracker = new assert.CallTracker();
111
- *
112
- * function func() {}
113
- *
114
- * // Returns a function that wraps func() that must be called exact times
115
- * // before tracker.verify().
116
- * const callsfunc = tracker.calls(func, 2);
117
- *
118
- * // Returns an array containing information on callsfunc()
119
- * console.log(tracker.report());
120
- * // [
121
- * // {
122
- * // message: 'Expected the func function to be executed 2 time(s) but was
123
- * // executed 0 time(s).',
124
- * // actual: 0,
125
- * // expected: 2,
126
- * // operator: 'func',
127
- * // stack: stack trace
128
- * // }
129
- * // ]
130
- * ```
131
- * @since v14.2.0, v12.19.0
132
- * @return An array of objects containing information about the wrapper functions returned by {@link tracker.calls()}.
133
- */
134
- report(): CallTrackerReportInformation[];
135
- /**
136
- * Reset calls of the call tracker. If a tracked function is passed as an argument, the calls will be reset for it.
137
- * If no arguments are passed, all tracked functions will be reset.
138
- *
139
- * ```js
140
- * import assert from 'node:assert';
141
- *
142
- * const tracker = new assert.CallTracker();
143
- *
144
- * function func() {}
145
- * const callsfunc = tracker.calls(func);
146
- *
147
- * callsfunc();
148
- * // Tracker was called once
149
- * assert.strictEqual(tracker.getCalls(callsfunc).length, 1);
150
- *
151
- * tracker.reset(callsfunc);
152
- * assert.strictEqual(tracker.getCalls(callsfunc).length, 0);
153
- * ```
154
- * @since v18.8.0, v16.18.0
155
- * @param fn a tracked function to reset.
156
- */
157
- reset(fn?: Function): void;
158
- /**
159
- * Iterates through the list of functions passed to {@link tracker.calls()} and will throw an error for functions that
160
- * have not been called the expected number of times.
161
- *
162
- * ```js
163
- * import assert from 'node:assert';
164
- *
165
- * // Creates call tracker.
166
- * const tracker = new assert.CallTracker();
167
- *
168
- * function func() {}
169
- *
170
- * // Returns a function that wraps func() that must be called exact times
171
- * // before tracker.verify().
172
- * const callsfunc = tracker.calls(func, 2);
173
- *
174
- * callsfunc();
175
- *
176
- * // Will throw an error since callsfunc() was only called once.
177
- * tracker.verify();
178
- * ```
179
- * @since v14.2.0, v12.19.0
180
- */
181
- verify(): void;
182
- }
183
- interface CallTrackerCall {
184
- thisArg: object;
185
- arguments: unknown[];
186
- }
187
- interface CallTrackerReportInformation {
188
- message: string;
189
- /** The actual number of times the function was called. */
190
- actual: number;
191
- /** The number of times the function was expected to be called. */
192
- expected: number;
193
- /** The name of the function that is wrapped. */
194
- operator: string;
195
- /** A stack trace of the function. */
196
- stack: object;
197
- }
198
- type AssertPredicate = RegExp | (new() => object) | ((thrown: unknown) => boolean) | object | Error;
199
- /**
200
- * Throws an `AssertionError` with the provided error message or a default
201
- * error message. If the `message` parameter is an instance of an `Error` then
202
- * it will be thrown instead of the `AssertionError`.
203
- *
204
- * ```js
205
- * import assert from 'node:assert/strict';
206
- *
207
- * assert.fail();
208
- * // AssertionError [ERR_ASSERTION]: Failed
209
- *
210
- * assert.fail('boom');
211
- * // AssertionError [ERR_ASSERTION]: boom
212
- *
213
- * assert.fail(new TypeError('need array'));
214
- * // TypeError: need array
215
- * ```
216
- *
217
- * Using `assert.fail()` with more than two arguments is possible but deprecated.
218
- * See below for further details.
219
- * @since v0.1.21
220
- * @param [message='Failed']
221
- */
222
- function fail(message?: string | Error): never;
223
- /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
224
- function fail(
225
- actual: unknown,
226
- expected: unknown,
227
- message?: string | Error,
228
- operator?: string,
229
- // eslint-disable-next-line @typescript-eslint/ban-types
230
- stackStartFn?: Function,
231
- ): never;
232
- /**
233
- * Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`.
234
- *
235
- * If `value` is not truthy, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is `undefined`, a default
236
- * error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
237
- * If no arguments are passed in at all `message` will be set to the string:`` 'No value argument passed to `assert.ok()`' ``.
238
- *
239
- * Be aware that in the `repl` the error message will be different to the one
240
- * thrown in a file! See below for further details.
241
- *
242
- * ```js
243
- * import assert from 'node:assert/strict';
244
- *
245
- * assert.ok(true);
246
- * // OK
247
- * assert.ok(1);
248
- * // OK
249
- *
250
- * assert.ok();
251
- * // AssertionError: No value argument passed to `assert.ok()`
252
- *
253
- * assert.ok(false, 'it\'s false');
254
- * // AssertionError: it's false
255
- *
256
- * // In the repl:
257
- * assert.ok(typeof 123 === 'string');
258
- * // AssertionError: false == true
259
- *
260
- * // In a file (e.g. test.js):
261
- * assert.ok(typeof 123 === 'string');
262
- * // AssertionError: The expression evaluated to a falsy value:
263
- * //
264
- * // assert.ok(typeof 123 === 'string')
265
- *
266
- * assert.ok(false);
267
- * // AssertionError: The expression evaluated to a falsy value:
268
- * //
269
- * // assert.ok(false)
270
- *
271
- * assert.ok(0);
272
- * // AssertionError: The expression evaluated to a falsy value:
273
- * //
274
- * // assert.ok(0)
275
- * ```
276
- *
277
- * ```js
278
- * import assert from 'node:assert/strict';
279
- *
280
- * // Using `assert()` works the same:
281
- * assert(0);
282
- * // AssertionError: The expression evaluated to a falsy value:
283
- * //
284
- * // assert(0)
285
- * ```
286
- * @since v0.1.21
287
- */
288
- function ok(value: unknown, message?: string | Error): asserts value;
289
- /**
290
- * **Strict assertion mode**
291
- *
292
- * An alias of {@link strictEqual}.
293
- *
294
- * **Legacy assertion mode**
295
- *
296
- * > Stability: 3 - Legacy: Use {@link strictEqual} instead.
297
- *
298
- * Tests shallow, coercive equality between the `actual` and `expected` parameters
299
- * using the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality). `NaN` is specially handled
300
- * and treated as being identical if both sides are `NaN`.
301
- *
302
- * ```js
303
- * import assert from 'node:assert';
304
- *
305
- * assert.equal(1, 1);
306
- * // OK, 1 == 1
307
- * assert.equal(1, '1');
308
- * // OK, 1 == '1'
309
- * assert.equal(NaN, NaN);
310
- * // OK
311
- *
312
- * assert.equal(1, 2);
313
- * // AssertionError: 1 == 2
314
- * assert.equal({ a: { b: 1 } }, { a: { b: 1 } });
315
- * // AssertionError: { a: { b: 1 } } == { a: { b: 1 } }
316
- * ```
317
- *
318
- * If the values are not equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default
319
- * error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
320
- * @since v0.1.21
321
- */
322
- function equal(actual: unknown, expected: unknown, message?: string | Error): void;
323
- /**
324
- * **Strict assertion mode**
325
- *
326
- * An alias of {@link notStrictEqual}.
327
- *
328
- * **Legacy assertion mode**
329
- *
330
- * > Stability: 3 - Legacy: Use {@link notStrictEqual} instead.
331
- *
332
- * Tests shallow, coercive inequality with the [`!=` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality). `NaN` is
333
- * specially handled and treated as being identical if both sides are `NaN`.
334
- *
335
- * ```js
336
- * import assert from 'node:assert';
337
- *
338
- * assert.notEqual(1, 2);
339
- * // OK
340
- *
341
- * assert.notEqual(1, 1);
342
- * // AssertionError: 1 != 1
343
- *
344
- * assert.notEqual(1, '1');
345
- * // AssertionError: 1 != '1'
346
- * ```
347
- *
348
- * If the values are equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default error
349
- * message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
350
- * @since v0.1.21
351
- */
352
- function notEqual(actual: unknown, expected: unknown, message?: string | Error): void;
353
- /**
354
- * **Strict assertion mode**
355
- *
356
- * An alias of {@link deepStrictEqual}.
357
- *
358
- * **Legacy assertion mode**
359
- *
360
- * > Stability: 3 - Legacy: Use {@link deepStrictEqual} instead.
361
- *
362
- * Tests for deep equality between the `actual` and `expected` parameters. Consider
363
- * using {@link deepStrictEqual} instead. {@link deepEqual} can have
364
- * surprising results.
365
- *
366
- * _Deep equality_ means that the enumerable "own" properties of child objects
367
- * are also recursively evaluated by the following rules.
368
- * @since v0.1.21
369
- */
370
- function deepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
371
- /**
372
- * **Strict assertion mode**
373
- *
374
- * An alias of {@link notDeepStrictEqual}.
375
- *
376
- * **Legacy assertion mode**
377
- *
378
- * > Stability: 3 - Legacy: Use {@link notDeepStrictEqual} instead.
379
- *
380
- * Tests for any deep inequality. Opposite of {@link deepEqual}.
381
- *
382
- * ```js
383
- * import assert from 'node:assert';
384
- *
385
- * const obj1 = {
386
- * a: {
387
- * b: 1,
388
- * },
389
- * };
390
- * const obj2 = {
391
- * a: {
392
- * b: 2,
393
- * },
394
- * };
395
- * const obj3 = {
396
- * a: {
397
- * b: 1,
398
- * },
399
- * };
400
- * const obj4 = { __proto__: obj1 };
401
- *
402
- * assert.notDeepEqual(obj1, obj1);
403
- * // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
404
- *
405
- * assert.notDeepEqual(obj1, obj2);
406
- * // OK
407
- *
408
- * assert.notDeepEqual(obj1, obj3);
409
- * // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
410
- *
411
- * assert.notDeepEqual(obj1, obj4);
412
- * // OK
413
- * ```
414
- *
415
- * If the values are deeply equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default
416
- * error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
417
- * instead of the `AssertionError`.
418
- * @since v0.1.21
419
- */
420
- function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
421
- /**
422
- * Tests strict equality between the `actual` and `expected` parameters as
423
- * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
424
- *
425
- * ```js
426
- * import assert from 'node:assert/strict';
427
- *
428
- * assert.strictEqual(1, 2);
429
- * // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
430
- * //
431
- * // 1 !== 2
432
- *
433
- * assert.strictEqual(1, 1);
434
- * // OK
435
- *
436
- * assert.strictEqual('Hello foobar', 'Hello World!');
437
- * // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
438
- * // + actual - expected
439
- * //
440
- * // + 'Hello foobar'
441
- * // - 'Hello World!'
442
- * // ^
443
- *
444
- * const apples = 1;
445
- * const oranges = 2;
446
- * assert.strictEqual(apples, oranges, `apples ${apples} !== oranges ${oranges}`);
447
- * // AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2
448
- *
449
- * assert.strictEqual(1, '1', new TypeError('Inputs are not identical'));
450
- * // TypeError: Inputs are not identical
451
- * ```
452
- *
453
- * If the values are not strictly equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a
454
- * default error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
455
- * instead of the `AssertionError`.
456
- * @since v0.1.21
457
- */
458
- function strictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
459
- /**
460
- * Tests strict inequality between the `actual` and `expected` parameters as
461
- * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
462
- *
463
- * ```js
464
- * import assert from 'node:assert/strict';
465
- *
466
- * assert.notStrictEqual(1, 2);
467
- * // OK
468
- *
469
- * assert.notStrictEqual(1, 1);
470
- * // AssertionError [ERR_ASSERTION]: Expected "actual" to be strictly unequal to:
471
- * //
472
- * // 1
473
- *
474
- * assert.notStrictEqual(1, '1');
475
- * // OK
476
- * ```
477
- *
478
- * If the values are strictly equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a
479
- * default error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
480
- * instead of the `AssertionError`.
481
- * @since v0.1.21
482
- */
483
- function notStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
484
- /**
485
- * Tests for deep equality between the `actual` and `expected` parameters.
486
- * "Deep" equality means that the enumerable "own" properties of child objects
487
- * are recursively evaluated also by the following rules.
488
- * @since v1.2.0
489
- */
490
- function deepStrictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
491
- /**
492
- * Tests for deep strict inequality. Opposite of {@link deepStrictEqual}.
493
- *
494
- * ```js
495
- * import assert from 'node:assert/strict';
496
- *
497
- * assert.notDeepStrictEqual({ a: 1 }, { a: '1' });
498
- * // OK
499
- * ```
500
- *
501
- * If the values are deeply and strictly equal, an `AssertionError` is thrown
502
- * with a `message` property set equal to the value of the `message` parameter. If
503
- * the `message` parameter is undefined, a default error message is assigned. If
504
- * the `message` parameter is an instance of an `Error` then it will be thrown
505
- * instead of the `AssertionError`.
506
- * @since v1.2.0
507
- */
508
- function notDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
509
- /**
510
- * Expects the function `fn` to throw an error.
511
- *
512
- * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
513
- * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function,
514
- * a validation object where each property will be tested for strict deep equality,
515
- * or an instance of error where each property will be tested for strict deep
516
- * equality including the non-enumerable `message` and `name` properties. When
517
- * using an object, it is also possible to use a regular expression, when
518
- * validating against a string property. See below for examples.
519
- *
520
- * If specified, `message` will be appended to the message provided by the `AssertionError` if the `fn` call fails to throw or in case the error validation
521
- * fails.
522
- *
523
- * Custom validation object/error instance:
524
- *
525
- * ```js
526
- * import assert from 'node:assert/strict';
527
- *
528
- * const err = new TypeError('Wrong value');
529
- * err.code = 404;
530
- * err.foo = 'bar';
531
- * err.info = {
532
- * nested: true,
533
- * baz: 'text',
534
- * };
535
- * err.reg = /abc/i;
536
- *
537
- * assert.throws(
538
- * () => {
539
- * throw err;
540
- * },
541
- * {
542
- * name: 'TypeError',
543
- * message: 'Wrong value',
544
- * info: {
545
- * nested: true,
546
- * baz: 'text',
547
- * },
548
- * // Only properties on the validation object will be tested for.
549
- * // Using nested objects requires all properties to be present. Otherwise
550
- * // the validation is going to fail.
551
- * },
552
- * );
553
- *
554
- * // Using regular expressions to validate error properties:
555
- * assert.throws(
556
- * () => {
557
- * throw err;
558
- * },
559
- * {
560
- * // The `name` and `message` properties are strings and using regular
561
- * // expressions on those will match against the string. If they fail, an
562
- * // error is thrown.
563
- * name: /^TypeError$/,
564
- * message: /Wrong/,
565
- * foo: 'bar',
566
- * info: {
567
- * nested: true,
568
- * // It is not possible to use regular expressions for nested properties!
569
- * baz: 'text',
570
- * },
571
- * // The `reg` property contains a regular expression and only if the
572
- * // validation object contains an identical regular expression, it is going
573
- * // to pass.
574
- * reg: /abc/i,
575
- * },
576
- * );
577
- *
578
- * // Fails due to the different `message` and `name` properties:
579
- * assert.throws(
580
- * () => {
581
- * const otherErr = new Error('Not found');
582
- * // Copy all enumerable properties from `err` to `otherErr`.
583
- * for (const [key, value] of Object.entries(err)) {
584
- * otherErr[key] = value;
585
- * }
586
- * throw otherErr;
587
- * },
588
- * // The error's `message` and `name` properties will also be checked when using
589
- * // an error as validation object.
590
- * err,
591
- * );
592
- * ```
593
- *
594
- * Validate instanceof using constructor:
595
- *
596
- * ```js
597
- * import assert from 'node:assert/strict';
598
- *
599
- * assert.throws(
600
- * () => {
601
- * throw new Error('Wrong value');
602
- * },
603
- * Error,
604
- * );
605
- * ```
606
- *
607
- * Validate error message using [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions):
608
- *
609
- * Using a regular expression runs `.toString` on the error object, and will
610
- * therefore also include the error name.
611
- *
612
- * ```js
613
- * import assert from 'node:assert/strict';
614
- *
615
- * assert.throws(
616
- * () => {
617
- * throw new Error('Wrong value');
618
- * },
619
- * /^Error: Wrong value$/,
620
- * );
621
- * ```
622
- *
623
- * Custom error validation:
624
- *
625
- * The function must return `true` to indicate all internal validations passed.
626
- * It will otherwise fail with an `AssertionError`.
627
- *
628
- * ```js
629
- * import assert from 'node:assert/strict';
630
- *
631
- * assert.throws(
632
- * () => {
633
- * throw new Error('Wrong value');
634
- * },
635
- * (err) => {
636
- * assert(err instanceof Error);
637
- * assert(/value/.test(err));
638
- * // Avoid returning anything from validation functions besides `true`.
639
- * // Otherwise, it's not clear what part of the validation failed. Instead,
640
- * // throw an error about the specific validation that failed (as done in this
641
- * // example) and add as much helpful debugging information to that error as
642
- * // possible.
643
- * return true;
644
- * },
645
- * 'unexpected error',
646
- * );
647
- * ```
648
- *
649
- * `error` cannot be a string. If a string is provided as the second
650
- * argument, then `error` is assumed to be omitted and the string will be used for `message` instead. This can lead to easy-to-miss mistakes. Using the same
651
- * message as the thrown error message is going to result in an `ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using
652
- * a string as the second argument gets considered:
653
- *
654
- * ```js
655
- * import assert from 'node:assert/strict';
656
- *
657
- * function throwingFirst() {
658
- * throw new Error('First');
659
- * }
660
- *
661
- * function throwingSecond() {
662
- * throw new Error('Second');
663
- * }
664
- *
665
- * function notThrowing() {}
666
- *
667
- * // The second argument is a string and the input function threw an Error.
668
- * // The first case will not throw as it does not match for the error message
669
- * // thrown by the input function!
670
- * assert.throws(throwingFirst, 'Second');
671
- * // In the next example the message has no benefit over the message from the
672
- * // error and since it is not clear if the user intended to actually match
673
- * // against the error message, Node.js throws an `ERR_AMBIGUOUS_ARGUMENT` error.
674
- * assert.throws(throwingSecond, 'Second');
675
- * // TypeError [ERR_AMBIGUOUS_ARGUMENT]
676
- *
677
- * // The string is only used (as message) in case the function does not throw:
678
- * assert.throws(notThrowing, 'Second');
679
- * // AssertionError [ERR_ASSERTION]: Missing expected exception: Second
680
- *
681
- * // If it was intended to match for the error message do this instead:
682
- * // It does not throw because the error messages match.
683
- * assert.throws(throwingSecond, /Second$/);
684
- *
685
- * // If the error message does not match, an AssertionError is thrown.
686
- * assert.throws(throwingFirst, /Second$/);
687
- * // AssertionError [ERR_ASSERTION]
688
- * ```
689
- *
690
- * Due to the confusing error-prone notation, avoid a string as the second
691
- * argument.
692
- * @since v0.1.21
693
- */
694
- function throws(block: () => unknown, message?: string | Error): void;
695
- function throws(block: () => unknown, error: AssertPredicate, message?: string | Error): void;
696
- /**
697
- * Asserts that the function `fn` does not throw an error.
698
- *
699
- * Using `assert.doesNotThrow()` is actually not useful because there
700
- * is no benefit in catching an error and then rethrowing it. Instead, consider
701
- * adding a comment next to the specific code path that should not throw and keep
702
- * error messages as expressive as possible.
703
- *
704
- * When `assert.doesNotThrow()` is called, it will immediately call the `fn` function.
705
- *
706
- * If an error is thrown and it is the same type as that specified by the `error` parameter, then an `AssertionError` is thrown. If the error is of a
707
- * different type, or if the `error` parameter is undefined, the error is
708
- * propagated back to the caller.
709
- *
710
- * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
711
- * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation
712
- * function. See {@link throws} for more details.
713
- *
714
- * The following, for instance, will throw the `TypeError` because there is no
715
- * matching error type in the assertion:
716
- *
717
- * ```js
718
- * import assert from 'node:assert/strict';
719
- *
720
- * assert.doesNotThrow(
721
- * () => {
722
- * throw new TypeError('Wrong value');
723
- * },
724
- * SyntaxError,
725
- * );
726
- * ```
727
- *
728
- * However, the following will result in an `AssertionError` with the message
729
- * 'Got unwanted exception...':
730
- *
731
- * ```js
732
- * import assert from 'node:assert/strict';
733
- *
734
- * assert.doesNotThrow(
735
- * () => {
736
- * throw new TypeError('Wrong value');
737
- * },
738
- * TypeError,
739
- * );
740
- * ```
741
- *
742
- * If an `AssertionError` is thrown and a value is provided for the `message` parameter, the value of `message` will be appended to the `AssertionError` message:
743
- *
744
- * ```js
745
- * import assert from 'node:assert/strict';
746
- *
747
- * assert.doesNotThrow(
748
- * () => {
749
- * throw new TypeError('Wrong value');
750
- * },
751
- * /Wrong value/,
752
- * 'Whoops',
753
- * );
754
- * // Throws: AssertionError: Got unwanted exception: Whoops
755
- * ```
756
- * @since v0.1.21
757
- */
758
- function doesNotThrow(block: () => unknown, message?: string | Error): void;
759
- function doesNotThrow(block: () => unknown, error: AssertPredicate, message?: string | Error): void;
760
- /**
761
- * Throws `value` if `value` is not `undefined` or `null`. This is useful when
762
- * testing the `error` argument in callbacks. The stack trace contains all frames
763
- * from the error passed to `ifError()` including the potential new frames for `ifError()` itself.
764
- *
765
- * ```js
766
- * import assert from 'node:assert/strict';
767
- *
768
- * assert.ifError(null);
769
- * // OK
770
- * assert.ifError(0);
771
- * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 0
772
- * assert.ifError('error');
773
- * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 'error'
774
- * assert.ifError(new Error());
775
- * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Error
776
- *
777
- * // Create some random error frames.
778
- * let err;
779
- * (function errorFrame() {
780
- * err = new Error('test error');
781
- * })();
782
- *
783
- * (function ifErrorFrame() {
784
- * assert.ifError(err);
785
- * })();
786
- * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error
787
- * // at ifErrorFrame
788
- * // at errorFrame
789
- * ```
790
- * @since v0.1.97
791
- */
792
- function ifError(value: unknown): asserts value is null | undefined;
793
- /**
794
- * Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
795
- * calls the function and awaits the returned promise to complete. It will then
796
- * check that the promise is rejected.
797
- *
798
- * If `asyncFn` is a function and it throws an error synchronously, `assert.rejects()` will return a rejected `Promise` with that error. If the
799
- * function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v20.x/api/errors.html#err_invalid_return_value)
800
- * error. In both cases the error handler is skipped.
801
- *
802
- * Besides the async nature to await the completion behaves identically to {@link throws}.
803
- *
804
- * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
805
- * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function,
806
- * an object where each property will be tested for, or an instance of error where
807
- * each property will be tested for including the non-enumerable `message` and `name` properties.
808
- *
809
- * If specified, `message` will be the message provided by the `{@link AssertionError}` if the `asyncFn` fails to reject.
810
- *
811
- * ```js
812
- * import assert from 'node:assert/strict';
813
- *
814
- * await assert.rejects(
815
- * async () => {
816
- * throw new TypeError('Wrong value');
817
- * },
818
- * {
819
- * name: 'TypeError',
820
- * message: 'Wrong value',
821
- * },
822
- * );
823
- * ```
824
- *
825
- * ```js
826
- * import assert from 'node:assert/strict';
827
- *
828
- * await assert.rejects(
829
- * async () => {
830
- * throw new TypeError('Wrong value');
831
- * },
832
- * (err) => {
833
- * assert.strictEqual(err.name, 'TypeError');
834
- * assert.strictEqual(err.message, 'Wrong value');
835
- * return true;
836
- * },
837
- * );
838
- * ```
839
- *
840
- * ```js
841
- * import assert from 'node:assert/strict';
842
- *
843
- * assert.rejects(
844
- * Promise.reject(new Error('Wrong value')),
845
- * Error,
846
- * ).then(() => {
847
- * // ...
848
- * });
849
- * ```
850
- *
851
- * `error` cannot be a string. If a string is provided as the second argument, then `error` is assumed to
852
- * be omitted and the string will be used for `message` instead. This can lead to easy-to-miss mistakes. Please read the
853
- * example in {@link throws} carefully if using a string as the second argument gets considered.
854
- * @since v10.0.0
855
- */
856
- function rejects(block: (() => Promise<unknown>) | Promise<unknown>, message?: string | Error): Promise<void>;
857
- function rejects(
858
- block: (() => Promise<unknown>) | Promise<unknown>,
859
- error: AssertPredicate,
860
- message?: string | Error,
861
- ): Promise<void>;
862
- /**
863
- * Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
864
- * calls the function and awaits the returned promise to complete. It will then
865
- * check that the promise is not rejected.
866
- *
867
- * If `asyncFn` is a function and it throws an error synchronously, `assert.doesNotReject()` will return a rejected `Promise` with that error. If
868
- * the function does not return a promise, `assert.doesNotReject()` will return a
869
- * rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v20.x/api/errors.html#err_invalid_return_value) error. In both cases
870
- * the error handler is skipped.
871
- *
872
- * Using `assert.doesNotReject()` is actually not useful because there is little
873
- * benefit in catching a rejection and then rejecting it again. Instead, consider
874
- * adding a comment next to the specific code path that should not reject and keep
875
- * error messages as expressive as possible.
876
- *
877
- * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
878
- * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation
879
- * function. See {@link throws} for more details.
880
- *
881
- * Besides the async nature to await the completion behaves identically to {@link doesNotThrow}.
882
- *
883
- * ```js
884
- * import assert from 'node:assert/strict';
885
- *
886
- * await assert.doesNotReject(
887
- * async () => {
888
- * throw new TypeError('Wrong value');
889
- * },
890
- * SyntaxError,
891
- * );
892
- * ```
893
- *
894
- * ```js
895
- * import assert from 'node:assert/strict';
896
- *
897
- * assert.doesNotReject(Promise.reject(new TypeError('Wrong value')))
898
- * .then(() => {
899
- * // ...
900
- * });
901
- * ```
902
- * @since v10.0.0
903
- */
904
- function doesNotReject(
905
- block: (() => Promise<unknown>) | Promise<unknown>,
906
- message?: string | Error,
907
- ): Promise<void>;
908
- function doesNotReject(
909
- block: (() => Promise<unknown>) | Promise<unknown>,
910
- error: AssertPredicate,
911
- message?: string | Error,
912
- ): Promise<void>;
913
- /**
914
- * Expects the `string` input to match the regular expression.
915
- *
916
- * ```js
917
- * import assert from 'node:assert/strict';
918
- *
919
- * assert.match('I will fail', /pass/);
920
- * // AssertionError [ERR_ASSERTION]: The input did not match the regular ...
921
- *
922
- * assert.match(123, /pass/);
923
- * // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string.
924
- *
925
- * assert.match('I will pass', /pass/);
926
- * // OK
927
- * ```
928
- *
929
- * 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
930
- * to the value of the `message` parameter. If the `message` parameter is
931
- * undefined, a default error message is assigned. If the `message` parameter is an
932
- * instance of an [Error](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
933
- * @since v13.6.0, v12.16.0
934
- */
935
- function match(value: string, regExp: RegExp, message?: string | Error): void;
936
- /**
937
- * Expects the `string` input not to match the regular expression.
938
- *
939
- * ```js
940
- * import assert from 'node:assert/strict';
941
- *
942
- * assert.doesNotMatch('I will fail', /fail/);
943
- * // AssertionError [ERR_ASSERTION]: The input was expected to not match the ...
944
- *
945
- * assert.doesNotMatch(123, /pass/);
946
- * // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string.
947
- *
948
- * assert.doesNotMatch('I will pass', /different/);
949
- * // OK
950
- * ```
951
- *
952
- * 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
953
- * to the value of the `message` parameter. If the `message` parameter is
954
- * undefined, a default error message is assigned. If the `message` parameter is an
955
- * instance of an [Error](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
956
- * @since v13.6.0, v12.16.0
957
- */
958
- function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
959
- /**
960
- * In strict assertion mode, non-strict methods behave like their corresponding strict methods. For example,
961
- * {@link deepEqual} will behave like {@link deepStrictEqual}.
962
- *
963
- * In strict assertion mode, error messages for objects display a diff. In legacy assertion mode, error
964
- * messages for objects display the objects, often truncated.
965
- *
966
- * To use strict assertion mode:
967
- *
968
- * ```js
969
- * import { strict as assert } from 'node:assert';COPY
970
- * import assert from 'node:assert/strict';
971
- * ```
972
- *
973
- * Example error diff:
974
- *
975
- * ```js
976
- * import { strict as assert } from 'node:assert';
977
- *
978
- * assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
979
- * // AssertionError: Expected inputs to be strictly deep-equal:
980
- * // + actual - expected ... Lines skipped
981
- * //
982
- * // [
983
- * // [
984
- * // ...
985
- * // 2,
986
- * // + 3
987
- * // - '3'
988
- * // ],
989
- * // ...
990
- * // 5
991
- * // ]
992
- * ```
993
- *
994
- * To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS` environment variables. This will also
995
- * deactivate the colors in the REPL. For more on color support in terminal environments, read the tty
996
- * `getColorDepth()` documentation.
997
- *
998
- * @since v15.0.0, v13.9.0, v12.16.2, v9.9.0
999
- */
1000
- namespace strict {
1001
- type AssertionError = assert.AssertionError;
1002
- type AssertPredicate = assert.AssertPredicate;
1003
- type CallTrackerCall = assert.CallTrackerCall;
1004
- type CallTrackerReportInformation = assert.CallTrackerReportInformation;
1005
- }
1006
- const strict:
1007
- & Omit<
1008
- typeof assert,
1009
- | "equal"
1010
- | "notEqual"
1011
- | "deepEqual"
1012
- | "notDeepEqual"
1013
- | "ok"
1014
- | "strictEqual"
1015
- | "deepStrictEqual"
1016
- | "ifError"
1017
- | "strict"
1018
- >
1019
- & {
1020
- (value: unknown, message?: string | Error): asserts value;
1021
- equal: typeof strictEqual;
1022
- notEqual: typeof notStrictEqual;
1023
- deepEqual: typeof deepStrictEqual;
1024
- notDeepEqual: typeof notDeepStrictEqual;
1025
- // Mapped types and assertion functions are incompatible?
1026
- // TS2775: Assertions require every name in the call target
1027
- // to be declared with an explicit type annotation.
1028
- ok: typeof ok;
1029
- strictEqual: typeof strictEqual;
1030
- deepStrictEqual: typeof deepStrictEqual;
1031
- ifError: typeof ifError;
1032
- strict: typeof strict;
1033
- };
1034
- }
1035
- export = assert;
1036
- }
1037
- declare module "node:assert" {
1038
- import assert = require("assert");
1039
- export = assert;
1040
- }