m06_task3.js 1.0.0

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