@emulsify/cli 1.10.2 → 1.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/node_modules/.package-lock.json +22 -22
- package/dist/node_modules/@types/node/README.md +1 -1
- package/dist/node_modules/@types/node/assert.d.ts +2 -2
- package/dist/node_modules/@types/node/buffer.buffer.d.ts +385 -0
- package/dist/node_modules/@types/node/buffer.d.ts +42 -390
- package/dist/node_modules/@types/node/child_process.d.ts +32 -28
- package/dist/node_modules/@types/node/cluster.d.ts +1 -1
- package/dist/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
- package/dist/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/dist/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- package/dist/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/dist/node_modules/@types/node/console.d.ts +2 -2
- package/dist/node_modules/@types/node/crypto.d.ts +3 -3
- package/dist/node_modules/@types/node/dns/promises.d.ts +6 -5
- package/dist/node_modules/@types/node/dns.d.ts +5 -5
- package/dist/node_modules/@types/node/domain.d.ts +2 -2
- package/dist/node_modules/@types/node/events.d.ts +3 -3
- package/dist/node_modules/@types/node/fs/promises.d.ts +2 -2
- package/dist/node_modules/@types/node/fs.d.ts +2 -2
- package/dist/node_modules/@types/node/globals.d.ts +124 -68
- package/dist/node_modules/@types/node/globals.typedarray.d.ts +21 -0
- package/dist/node_modules/@types/node/http.d.ts +43 -7
- package/dist/node_modules/@types/node/http2.d.ts +238 -101
- package/dist/node_modules/@types/node/https.d.ts +17 -23
- package/dist/node_modules/@types/node/index.d.ts +11 -9
- package/dist/node_modules/@types/node/inspector.d.ts +1061 -111
- package/dist/node_modules/@types/node/module.d.ts +3 -3
- package/dist/node_modules/@types/node/net.d.ts +8 -2
- package/dist/node_modules/@types/node/os.d.ts +1 -1
- package/dist/node_modules/@types/node/package.json +11 -3
- package/dist/node_modules/@types/node/path.d.ts +10 -1
- package/dist/node_modules/@types/node/perf_hooks.d.ts +49 -20
- package/dist/node_modules/@types/node/process.d.ts +142 -17
- package/dist/node_modules/@types/node/punycode.d.ts +1 -1
- package/dist/node_modules/@types/node/querystring.d.ts +1 -1
- package/dist/node_modules/@types/node/readline/promises.d.ts +1 -1
- package/dist/node_modules/@types/node/readline.d.ts +10 -10
- package/dist/node_modules/@types/node/repl.d.ts +4 -4
- package/dist/node_modules/@types/node/stream/promises.d.ts +8 -1
- package/dist/node_modules/@types/node/stream/web.d.ts +182 -25
- package/dist/node_modules/@types/node/stream.d.ts +36 -17
- package/dist/node_modules/@types/node/string_decoder.d.ts +3 -3
- package/dist/node_modules/@types/node/test.d.ts +313 -94
- package/dist/node_modules/@types/node/timers/promises.d.ts +1 -1
- package/dist/node_modules/@types/node/timers.d.ts +1 -1
- package/dist/node_modules/@types/node/tls.d.ts +5 -5
- package/dist/node_modules/@types/node/trace_events.d.ts +4 -4
- package/dist/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +385 -0
- package/dist/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +19 -0
- package/dist/node_modules/@types/node/ts5.6/index.d.ts +91 -0
- package/dist/node_modules/@types/node/tty.d.ts +1 -1
- package/dist/node_modules/@types/node/url.d.ts +14 -11
- package/dist/node_modules/@types/node/util.d.ts +55 -49
- package/dist/node_modules/@types/node/v8.d.ts +12 -12
- package/dist/node_modules/@types/node/vm.d.ts +11 -12
- package/dist/node_modules/@types/node/worker_threads.d.ts +22 -22
- package/dist/node_modules/@types/node/zlib.d.ts +17 -8
- package/dist/node_modules/debug/README.md +1 -1
- package/dist/node_modules/debug/package.json +2 -2
- package/dist/node_modules/fast-uri/.github/workflows/ci.yml +2 -2
- package/dist/node_modules/fast-uri/.github/workflows/package-manager-ci.yml +1 -1
- package/dist/node_modules/fast-uri/index.js +3 -9
- package/dist/node_modules/fast-uri/package.json +4 -4
- package/dist/node_modules/fast-uri/test/ajv.test.js +1 -1
- package/dist/node_modules/fast-uri/test/compatibility.test.js +3 -2
- package/dist/node_modules/fast-uri/test/equal.test.js +1 -2
- package/dist/node_modules/fast-uri/test/parse.test.js +1 -2
- package/dist/node_modules/fast-uri/test/resolve.test.js +1 -2
- package/dist/node_modules/fast-uri/test/serialize.test.js +1 -2
- package/dist/node_modules/fast-uri/test/uri-js.test.js +539 -567
- package/dist/node_modules/fast-uri/test/util.test.js +2 -3
- package/dist/node_modules/ms/index.js +1 -1
- package/dist/node_modules/ms/license.md +1 -1
- package/dist/node_modules/ms/package.json +5 -4
- package/dist/node_modules/ms/readme.md +1 -2
- package/dist/node_modules/simple-git/dist/cjs/index.js +14 -15
- package/dist/node_modules/simple-git/dist/cjs/index.js.map +2 -2
- package/dist/node_modules/simple-git/dist/esm/index.js +14 -15
- package/dist/node_modules/simple-git/dist/esm/index.js.map +2 -2
- package/dist/node_modules/simple-git/dist/typings/response.d.ts +7 -6
- package/dist/node_modules/simple-git/package.json +5 -5
- package/dist/node_modules/undici-types/LICENSE +21 -0
- package/dist/node_modules/undici-types/balanced-pool.d.ts +11 -0
- package/dist/node_modules/undici-types/client.d.ts +12 -1
- package/dist/node_modules/undici-types/diagnostics-channel.d.ts +1 -2
- package/dist/node_modules/undici-types/dispatcher.d.ts +18 -4
- package/dist/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
- package/dist/node_modules/undici-types/errors.d.ts +21 -0
- package/dist/node_modules/undici-types/eventsource.d.ts +63 -0
- package/dist/node_modules/undici-types/fetch.d.ts +25 -25
- package/dist/node_modules/undici-types/formdata.d.ts +1 -1
- package/dist/node_modules/undici-types/handlers.d.ts +10 -4
- package/dist/node_modules/undici-types/index.d.ts +10 -2
- package/dist/node_modules/undici-types/interceptors.d.ts +12 -2
- package/dist/node_modules/undici-types/mock-interceptor.d.ts +4 -4
- package/dist/node_modules/undici-types/package.json +1 -1
- package/dist/node_modules/undici-types/pool.d.ts +11 -0
- package/dist/node_modules/undici-types/proxy-agent.d.ts +0 -2
- package/dist/node_modules/undici-types/readable.d.ts +2 -3
- package/dist/node_modules/undici-types/retry-agent.d.ts +8 -0
- package/dist/node_modules/undici-types/retry-handler.d.ts +116 -0
- package/dist/node_modules/undici-types/util.d.ts +18 -0
- package/dist/node_modules/undici-types/webidl.d.ts +10 -8
- package/dist/node_modules/undici-types/websocket.d.ts +22 -1
- package/dist/package-lock.json +834 -700
- package/dist/package.json +2 -2
- package/dist/util/system/getAvailableSystems.js +5 -0
- package/package.json +2 -2
- package/dist/node_modules/@types/node/globals.global.d.ts +0 -1
- package/dist/node_modules/fast-uri/.taprc +0 -3
|
@@ -80,7 +80,6 @@
|
|
|
80
80
|
*/
|
|
81
81
|
declare module "node:test" {
|
|
82
82
|
import { Readable } from "node:stream";
|
|
83
|
-
import { AsyncResource } from "node:async_hooks";
|
|
84
83
|
/**
|
|
85
84
|
* **Note:** `shard` is used to horizontally parallelize test running across
|
|
86
85
|
* machines or processes, ideal for large-scale executions across varied
|
|
@@ -98,7 +97,7 @@ declare module "node:test" {
|
|
|
98
97
|
* .pipe(process.stdout);
|
|
99
98
|
* ```
|
|
100
99
|
* @since v18.9.0, v16.19.0
|
|
101
|
-
* @param options Configuration options for running tests.
|
|
100
|
+
* @param options Configuration options for running tests.
|
|
102
101
|
*/
|
|
103
102
|
function run(options?: RunOptions): TestsStream;
|
|
104
103
|
/**
|
|
@@ -133,10 +132,11 @@ declare module "node:test" {
|
|
|
133
132
|
* canceling tests because a running test might block the application thread and
|
|
134
133
|
* thus prevent the scheduled cancellation.
|
|
135
134
|
* @since v18.0.0, v16.17.0
|
|
136
|
-
* @param
|
|
137
|
-
*
|
|
138
|
-
* @param
|
|
139
|
-
*
|
|
135
|
+
* @param name The name of the test, which is displayed when reporting test results.
|
|
136
|
+
* Defaults to the `name` property of `fn`, or `'<anonymous>'` if `fn` does not have a name.
|
|
137
|
+
* @param options Configuration options for the test.
|
|
138
|
+
* @param fn The function under test. The first argument to this function is a {@link TestContext} object.
|
|
139
|
+
* If the test uses callbacks, the callback function is passed as the second argument.
|
|
140
140
|
* @return Fulfilled with `undefined` once the test completes, or immediately if the test runs within a suite.
|
|
141
141
|
*/
|
|
142
142
|
function test(name?: string, fn?: TestFn): Promise<void>;
|
|
@@ -148,9 +148,10 @@ declare module "node:test" {
|
|
|
148
148
|
}
|
|
149
149
|
/**
|
|
150
150
|
* The `suite()` function is imported from the `node:test` module.
|
|
151
|
-
* @param name The name of the suite, which is displayed when reporting test results.
|
|
152
|
-
*
|
|
153
|
-
* @param
|
|
151
|
+
* @param name The name of the suite, which is displayed when reporting test results.
|
|
152
|
+
* Defaults to the `name` property of `fn`, or `'<anonymous>'` if `fn` does not have a name.
|
|
153
|
+
* @param options Configuration options for the suite. This supports the same options as {@link test}.
|
|
154
|
+
* @param fn The suite function declaring nested tests and suites. The first argument to this function is a {@link SuiteContext} object.
|
|
154
155
|
* @return Immediately fulfilled with `undefined`.
|
|
155
156
|
* @since v20.13.0
|
|
156
157
|
*/
|
|
@@ -160,7 +161,7 @@ declare module "node:test" {
|
|
|
160
161
|
function suite(fn?: SuiteFn): Promise<void>;
|
|
161
162
|
namespace suite {
|
|
162
163
|
/**
|
|
163
|
-
* Shorthand for skipping a suite. This is the same as
|
|
164
|
+
* Shorthand for skipping a suite. This is the same as calling {@link suite} with `options.skip` set to `true`.
|
|
164
165
|
* @since v20.13.0
|
|
165
166
|
*/
|
|
166
167
|
function skip(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
@@ -168,7 +169,7 @@ declare module "node:test" {
|
|
|
168
169
|
function skip(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
169
170
|
function skip(fn?: SuiteFn): Promise<void>;
|
|
170
171
|
/**
|
|
171
|
-
* Shorthand for marking a suite as `TODO`. This is the same as
|
|
172
|
+
* Shorthand for marking a suite as `TODO`. This is the same as calling {@link suite} with `options.todo` set to `true`.
|
|
172
173
|
* @since v20.13.0
|
|
173
174
|
*/
|
|
174
175
|
function todo(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
@@ -176,7 +177,7 @@ declare module "node:test" {
|
|
|
176
177
|
function todo(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
177
178
|
function todo(fn?: SuiteFn): Promise<void>;
|
|
178
179
|
/**
|
|
179
|
-
* Shorthand for marking a suite as `only`. This is the same as
|
|
180
|
+
* Shorthand for marking a suite as `only`. This is the same as calling {@link suite} with `options.only` set to `true`.
|
|
180
181
|
* @since v20.13.0
|
|
181
182
|
*/
|
|
182
183
|
function only(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
@@ -185,7 +186,7 @@ declare module "node:test" {
|
|
|
185
186
|
function only(fn?: SuiteFn): Promise<void>;
|
|
186
187
|
}
|
|
187
188
|
/**
|
|
188
|
-
* Alias for
|
|
189
|
+
* Alias for {@link suite}.
|
|
189
190
|
*
|
|
190
191
|
* The `describe()` function is imported from the `node:test` module.
|
|
191
192
|
*/
|
|
@@ -195,7 +196,7 @@ declare module "node:test" {
|
|
|
195
196
|
function describe(fn?: SuiteFn): Promise<void>;
|
|
196
197
|
namespace describe {
|
|
197
198
|
/**
|
|
198
|
-
* Shorthand for skipping a suite. This is the same as
|
|
199
|
+
* Shorthand for skipping a suite. This is the same as calling {@link describe} with `options.skip` set to `true`.
|
|
199
200
|
* @since v18.15.0
|
|
200
201
|
*/
|
|
201
202
|
function skip(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
@@ -203,7 +204,7 @@ declare module "node:test" {
|
|
|
203
204
|
function skip(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
204
205
|
function skip(fn?: SuiteFn): Promise<void>;
|
|
205
206
|
/**
|
|
206
|
-
* Shorthand for marking a suite as `TODO`. This is the same as
|
|
207
|
+
* Shorthand for marking a suite as `TODO`. This is the same as calling {@link describe} with `options.todo` set to `true`.
|
|
207
208
|
* @since v18.15.0
|
|
208
209
|
*/
|
|
209
210
|
function todo(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
@@ -211,7 +212,7 @@ declare module "node:test" {
|
|
|
211
212
|
function todo(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
212
213
|
function todo(fn?: SuiteFn): Promise<void>;
|
|
213
214
|
/**
|
|
214
|
-
* Shorthand for marking a suite as `only`. This is the same as
|
|
215
|
+
* Shorthand for marking a suite as `only`. This is the same as calling {@link describe} with `options.only` set to `true`.
|
|
215
216
|
* @since v18.15.0
|
|
216
217
|
*/
|
|
217
218
|
function only(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
|
@@ -220,7 +221,7 @@ declare module "node:test" {
|
|
|
220
221
|
function only(fn?: SuiteFn): Promise<void>;
|
|
221
222
|
}
|
|
222
223
|
/**
|
|
223
|
-
* Alias for
|
|
224
|
+
* Alias for {@link test}.
|
|
224
225
|
*
|
|
225
226
|
* The `it()` function is imported from the `node:test` module.
|
|
226
227
|
* @since v18.6.0, v16.17.0
|
|
@@ -231,21 +232,21 @@ declare module "node:test" {
|
|
|
231
232
|
function it(fn?: TestFn): Promise<void>;
|
|
232
233
|
namespace it {
|
|
233
234
|
/**
|
|
234
|
-
* Shorthand for skipping a test
|
|
235
|
+
* Shorthand for skipping a test. This is the same as calling {@link it} with `options.skip` set to `true`.
|
|
235
236
|
*/
|
|
236
237
|
function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
237
238
|
function skip(name?: string, fn?: TestFn): Promise<void>;
|
|
238
239
|
function skip(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
239
240
|
function skip(fn?: TestFn): Promise<void>;
|
|
240
241
|
/**
|
|
241
|
-
* Shorthand for marking a test as `TODO
|
|
242
|
+
* Shorthand for marking a test as `TODO`. This is the same as calling {@link it} with `options.todo` set to `true`.
|
|
242
243
|
*/
|
|
243
244
|
function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
244
245
|
function todo(name?: string, fn?: TestFn): Promise<void>;
|
|
245
246
|
function todo(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
246
247
|
function todo(fn?: TestFn): Promise<void>;
|
|
247
248
|
/**
|
|
248
|
-
* Shorthand for marking a test as `only
|
|
249
|
+
* Shorthand for marking a test as `only`. This is the same as calling {@link it} with `options.only` set to `true`.
|
|
249
250
|
* @since v18.15.0
|
|
250
251
|
*/
|
|
251
252
|
function only(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
@@ -254,7 +255,7 @@ declare module "node:test" {
|
|
|
254
255
|
function only(fn?: TestFn): Promise<void>;
|
|
255
256
|
}
|
|
256
257
|
/**
|
|
257
|
-
* Shorthand for skipping a test
|
|
258
|
+
* Shorthand for skipping a test. This is the same as calling {@link test} with `options.skip` set to `true`.
|
|
258
259
|
* @since v20.2.0
|
|
259
260
|
*/
|
|
260
261
|
function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
@@ -262,7 +263,7 @@ declare module "node:test" {
|
|
|
262
263
|
function skip(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
263
264
|
function skip(fn?: TestFn): Promise<void>;
|
|
264
265
|
/**
|
|
265
|
-
* Shorthand for marking a test as `TODO
|
|
266
|
+
* Shorthand for marking a test as `TODO`. This is the same as calling {@link test} with `options.todo` set to `true`.
|
|
266
267
|
* @since v20.2.0
|
|
267
268
|
*/
|
|
268
269
|
function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
@@ -270,7 +271,7 @@ declare module "node:test" {
|
|
|
270
271
|
function todo(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
271
272
|
function todo(fn?: TestFn): Promise<void>;
|
|
272
273
|
/**
|
|
273
|
-
* Shorthand for marking a test as `only
|
|
274
|
+
* Shorthand for marking a test as `only`. This is the same as calling {@link test} with `options.only` set to `true`.
|
|
274
275
|
* @since v20.2.0
|
|
275
276
|
*/
|
|
276
277
|
function only(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
@@ -278,18 +279,17 @@ declare module "node:test" {
|
|
|
278
279
|
function only(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
279
280
|
function only(fn?: TestFn): Promise<void>;
|
|
280
281
|
/**
|
|
281
|
-
* The type of a function
|
|
282
|
-
*
|
|
283
|
-
* the second argument.
|
|
282
|
+
* The type of a function passed to {@link test}. The first argument to this function is a {@link TestContext} object.
|
|
283
|
+
* If the test uses callbacks, the callback function is passed as the second argument.
|
|
284
284
|
*/
|
|
285
285
|
type TestFn = (t: TestContext, done: (result?: any) => void) => void | Promise<void>;
|
|
286
286
|
/**
|
|
287
|
-
* The type of a function
|
|
287
|
+
* The type of a suite test function. The argument to this function is a {@link SuiteContext} object.
|
|
288
288
|
*/
|
|
289
289
|
type SuiteFn = (s: SuiteContext) => void | Promise<void>;
|
|
290
290
|
interface TestShard {
|
|
291
291
|
/**
|
|
292
|
-
* A positive integer between 1 and
|
|
292
|
+
* A positive integer between 1 and `total` that specifies the index of the shard to run.
|
|
293
293
|
*/
|
|
294
294
|
index: number;
|
|
295
295
|
/**
|
|
@@ -305,7 +305,7 @@ declare module "node:test" {
|
|
|
305
305
|
*/
|
|
306
306
|
concurrency?: number | boolean | undefined;
|
|
307
307
|
/**
|
|
308
|
-
* An array containing the list of files to run.
|
|
308
|
+
* An array containing the list of files to run. If omitted, files are run according to the
|
|
309
309
|
* [test runner execution model](https://nodejs.org/docs/latest-v20.x/api/test.html#test-runner-execution-model).
|
|
310
310
|
*/
|
|
311
311
|
files?: readonly string[] | undefined;
|
|
@@ -326,26 +326,24 @@ declare module "node:test" {
|
|
|
326
326
|
/**
|
|
327
327
|
* If truthy, the test context will only run tests that have the `only` option set
|
|
328
328
|
*/
|
|
329
|
-
only?: boolean;
|
|
329
|
+
only?: boolean | undefined;
|
|
330
330
|
/**
|
|
331
331
|
* A function that accepts the `TestsStream` instance and can be used to setup listeners before any tests are run.
|
|
332
332
|
* @default undefined
|
|
333
333
|
*/
|
|
334
|
-
setup?: (
|
|
334
|
+
setup?: ((reporter: TestsStream) => void | Promise<void>) | undefined;
|
|
335
335
|
/**
|
|
336
336
|
* Allows aborting an in-progress test execution.
|
|
337
337
|
*/
|
|
338
338
|
signal?: AbortSignal | undefined;
|
|
339
339
|
/**
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
* regular expressions. For each test that is executed, any corresponding test hooks,
|
|
343
|
-
* such as `beforeEach()`, are also run.
|
|
340
|
+
* If provided, only run tests whose name matches the provided pattern.
|
|
341
|
+
* Strings are interpreted as JavaScript regular expressions.
|
|
344
342
|
* @default undefined
|
|
345
343
|
*/
|
|
346
|
-
testNamePatterns?: string | RegExp | string
|
|
344
|
+
testNamePatterns?: string | RegExp | ReadonlyArray<string | RegExp> | undefined;
|
|
347
345
|
/**
|
|
348
|
-
*
|
|
346
|
+
* The number of milliseconds after which the test execution will fail.
|
|
349
347
|
* If unspecified, subtests inherit this value from their parent.
|
|
350
348
|
* @default Infinity
|
|
351
349
|
*/
|
|
@@ -361,18 +359,8 @@ declare module "node:test" {
|
|
|
361
359
|
*/
|
|
362
360
|
shard?: TestShard | undefined;
|
|
363
361
|
}
|
|
364
|
-
class Test extends AsyncResource {
|
|
365
|
-
concurrency: number;
|
|
366
|
-
nesting: number;
|
|
367
|
-
only: boolean;
|
|
368
|
-
reporter: TestsStream;
|
|
369
|
-
runOnlySubtests: boolean;
|
|
370
|
-
testNumber: number;
|
|
371
|
-
timeout: number | null;
|
|
372
|
-
}
|
|
373
362
|
/**
|
|
374
|
-
* A successful call to `run()`
|
|
375
|
-
* order of the tests definition
|
|
363
|
+
* A successful call to `run()` will return a new `TestsStream` object, streaming a series of events representing the execution of the tests.
|
|
376
364
|
*
|
|
377
365
|
* Some of the events are guaranteed to be emitted in the same order as the tests are defined, while others are emitted in the order that the tests execute.
|
|
378
366
|
* @since v18.9.0, v16.19.0
|
|
@@ -389,6 +377,7 @@ declare module "node:test" {
|
|
|
389
377
|
addListener(event: "test:start", listener: (data: TestStart) => void): this;
|
|
390
378
|
addListener(event: "test:stderr", listener: (data: TestStderr) => void): this;
|
|
391
379
|
addListener(event: "test:stdout", listener: (data: TestStdout) => void): this;
|
|
380
|
+
addListener(event: "test:watch:drained", listener: () => void): this;
|
|
392
381
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
393
382
|
emit(event: "test:coverage", data: TestCoverage): boolean;
|
|
394
383
|
emit(event: "test:complete", data: TestComplete): boolean;
|
|
@@ -401,6 +390,7 @@ declare module "node:test" {
|
|
|
401
390
|
emit(event: "test:start", data: TestStart): boolean;
|
|
402
391
|
emit(event: "test:stderr", data: TestStderr): boolean;
|
|
403
392
|
emit(event: "test:stdout", data: TestStdout): boolean;
|
|
393
|
+
emit(event: "test:watch:drained"): boolean;
|
|
404
394
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
405
395
|
on(event: "test:coverage", listener: (data: TestCoverage) => void): this;
|
|
406
396
|
on(event: "test:complete", listener: (data: TestComplete) => void): this;
|
|
@@ -413,6 +403,7 @@ declare module "node:test" {
|
|
|
413
403
|
on(event: "test:start", listener: (data: TestStart) => void): this;
|
|
414
404
|
on(event: "test:stderr", listener: (data: TestStderr) => void): this;
|
|
415
405
|
on(event: "test:stdout", listener: (data: TestStdout) => void): this;
|
|
406
|
+
on(event: "test:watch:drained", listener: () => void): this;
|
|
416
407
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
417
408
|
once(event: "test:coverage", listener: (data: TestCoverage) => void): this;
|
|
418
409
|
once(event: "test:complete", listener: (data: TestComplete) => void): this;
|
|
@@ -425,6 +416,7 @@ declare module "node:test" {
|
|
|
425
416
|
once(event: "test:start", listener: (data: TestStart) => void): this;
|
|
426
417
|
once(event: "test:stderr", listener: (data: TestStderr) => void): this;
|
|
427
418
|
once(event: "test:stdout", listener: (data: TestStdout) => void): this;
|
|
419
|
+
once(event: "test:watch:drained", listener: () => void): this;
|
|
428
420
|
once(event: string, listener: (...args: any[]) => void): this;
|
|
429
421
|
prependListener(event: "test:coverage", listener: (data: TestCoverage) => void): this;
|
|
430
422
|
prependListener(event: "test:complete", listener: (data: TestComplete) => void): this;
|
|
@@ -437,6 +429,7 @@ declare module "node:test" {
|
|
|
437
429
|
prependListener(event: "test:start", listener: (data: TestStart) => void): this;
|
|
438
430
|
prependListener(event: "test:stderr", listener: (data: TestStderr) => void): this;
|
|
439
431
|
prependListener(event: "test:stdout", listener: (data: TestStdout) => void): this;
|
|
432
|
+
prependListener(event: "test:watch:drained", listener: () => void): this;
|
|
440
433
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
441
434
|
prependOnceListener(event: "test:coverage", listener: (data: TestCoverage) => void): this;
|
|
442
435
|
prependOnceListener(event: "test:complete", listener: (data: TestComplete) => void): this;
|
|
@@ -449,6 +442,7 @@ declare module "node:test" {
|
|
|
449
442
|
prependOnceListener(event: "test:start", listener: (data: TestStart) => void): this;
|
|
450
443
|
prependOnceListener(event: "test:stderr", listener: (data: TestStderr) => void): this;
|
|
451
444
|
prependOnceListener(event: "test:stdout", listener: (data: TestStdout) => void): this;
|
|
445
|
+
prependOnceListener(event: "test:watch:drained", listener: () => void): this;
|
|
452
446
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
453
447
|
}
|
|
454
448
|
/**
|
|
@@ -458,38 +452,44 @@ declare module "node:test" {
|
|
|
458
452
|
* @since v18.0.0, v16.17.0
|
|
459
453
|
*/
|
|
460
454
|
class TestContext {
|
|
455
|
+
/**
|
|
456
|
+
* An object containing assertion methods bound to the test context.
|
|
457
|
+
* The top-level functions from the `node:assert` module are exposed here for the purpose of creating test plans.
|
|
458
|
+
* @since v20.15.0
|
|
459
|
+
*/
|
|
460
|
+
readonly assert: TestContextAssert;
|
|
461
461
|
/**
|
|
462
462
|
* This function is used to create a hook running before subtest of the current test.
|
|
463
|
-
* @param fn The hook function.
|
|
464
|
-
*
|
|
463
|
+
* @param fn The hook function. The first argument to this function is a `TestContext` object.
|
|
464
|
+
* If the hook uses callbacks, the callback function is passed as the second argument.
|
|
465
465
|
* @param options Configuration options for the hook.
|
|
466
|
-
* @since v20.1.0
|
|
466
|
+
* @since v20.1.0, v18.17.0
|
|
467
467
|
*/
|
|
468
|
-
before:
|
|
468
|
+
before(fn?: TestContextHookFn, options?: HookOptions): void;
|
|
469
469
|
/**
|
|
470
470
|
* This function is used to create a hook running before each subtest of the current test.
|
|
471
|
-
* @param fn The hook function.
|
|
472
|
-
*
|
|
471
|
+
* @param fn The hook function. The first argument to this function is a `TestContext` object.
|
|
472
|
+
* If the hook uses callbacks, the callback function is passed as the second argument.
|
|
473
473
|
* @param options Configuration options for the hook.
|
|
474
474
|
* @since v18.8.0
|
|
475
475
|
*/
|
|
476
|
-
beforeEach:
|
|
476
|
+
beforeEach(fn?: TestContextHookFn, options?: HookOptions): void;
|
|
477
477
|
/**
|
|
478
478
|
* This function is used to create a hook that runs after the current test finishes.
|
|
479
|
-
* @param
|
|
480
|
-
*
|
|
479
|
+
* @param fn The hook function. The first argument to this function is a `TestContext` object.
|
|
480
|
+
* If the hook uses callbacks, the callback function is passed as the second argument.
|
|
481
481
|
* @param options Configuration options for the hook.
|
|
482
482
|
* @since v18.13.0
|
|
483
483
|
*/
|
|
484
|
-
after:
|
|
484
|
+
after(fn?: TestContextHookFn, options?: HookOptions): void;
|
|
485
485
|
/**
|
|
486
486
|
* This function is used to create a hook running after each subtest of the current test.
|
|
487
|
-
* @param fn The hook function.
|
|
488
|
-
*
|
|
487
|
+
* @param fn The hook function. The first argument to this function is a `TestContext` object.
|
|
488
|
+
* If the hook uses callbacks, the callback function is passed as the second argument.
|
|
489
489
|
* @param options Configuration options for the hook.
|
|
490
490
|
* @since v18.8.0
|
|
491
491
|
*/
|
|
492
|
-
afterEach:
|
|
492
|
+
afterEach(fn?: TestContextHookFn, options?: HookOptions): void;
|
|
493
493
|
/**
|
|
494
494
|
* This function is used to write diagnostics to the output. Any diagnostic
|
|
495
495
|
* information is included at the end of the test's results. This function does
|
|
@@ -504,11 +504,52 @@ declare module "node:test" {
|
|
|
504
504
|
* @param message Message to be reported.
|
|
505
505
|
*/
|
|
506
506
|
diagnostic(message: string): void;
|
|
507
|
+
/**
|
|
508
|
+
* The name of the test and each of its ancestors, separated by `>`.
|
|
509
|
+
* @since v20.16.0
|
|
510
|
+
*/
|
|
511
|
+
readonly fullName: string;
|
|
507
512
|
/**
|
|
508
513
|
* The name of the test.
|
|
509
514
|
* @since v18.8.0, v16.18.0
|
|
510
515
|
*/
|
|
511
516
|
readonly name: string;
|
|
517
|
+
/**
|
|
518
|
+
* Used to set the number of assertions and subtests that are expected to run within the test.
|
|
519
|
+
* If the number of assertions and subtests that run does not match the expected count, the test will fail.
|
|
520
|
+
*
|
|
521
|
+
* To make sure assertions are tracked, the assert functions on `context.assert` must be used,
|
|
522
|
+
* instead of importing from the `node:assert` module.
|
|
523
|
+
* ```js
|
|
524
|
+
* test('top level test', (t) => {
|
|
525
|
+
* t.plan(2);
|
|
526
|
+
* t.assert.ok('some relevant assertion here');
|
|
527
|
+
* t.test('subtest', () => {});
|
|
528
|
+
* });
|
|
529
|
+
* ```
|
|
530
|
+
*
|
|
531
|
+
* When working with asynchronous code, the `plan` function can be used to ensure that the correct number of assertions are run:
|
|
532
|
+
* ```js
|
|
533
|
+
* test('planning with streams', (t, done) => {
|
|
534
|
+
* function* generate() {
|
|
535
|
+
* yield 'a';
|
|
536
|
+
* yield 'b';
|
|
537
|
+
* yield 'c';
|
|
538
|
+
* }
|
|
539
|
+
* const expected = ['a', 'b', 'c'];
|
|
540
|
+
* t.plan(expected.length);
|
|
541
|
+
* const stream = Readable.from(generate());
|
|
542
|
+
* stream.on('data', (chunk) => {
|
|
543
|
+
* t.assert.strictEqual(chunk, expected.shift());
|
|
544
|
+
* });
|
|
545
|
+
* stream.on('end', () => {
|
|
546
|
+
* done();
|
|
547
|
+
* });
|
|
548
|
+
* });
|
|
549
|
+
* ```
|
|
550
|
+
* @since v20.15.0
|
|
551
|
+
*/
|
|
552
|
+
plan(count: number): void;
|
|
512
553
|
/**
|
|
513
554
|
* If `shouldRunOnlyTests` is truthy, the test context will only run tests that
|
|
514
555
|
* have the `only` option set. Otherwise, all tests are run. If Node.js was not
|
|
@@ -573,11 +614,10 @@ declare module "node:test" {
|
|
|
573
614
|
* the same fashion as the top level {@link test} function.
|
|
574
615
|
* @since v18.0.0
|
|
575
616
|
* @param name The name of the test, which is displayed when reporting test results.
|
|
576
|
-
*
|
|
577
|
-
* @param options Configuration options for the test
|
|
578
|
-
* @param fn The function under test. This first argument to this function is a
|
|
579
|
-
*
|
|
580
|
-
* passed as the second argument. **Default:** A no-op function.
|
|
617
|
+
* Defaults to the `name` property of `fn`, or `'<anonymous>'` if `fn` does not have a name.
|
|
618
|
+
* @param options Configuration options for the test.
|
|
619
|
+
* @param fn The function under test. This first argument to this function is a {@link TestContext} object.
|
|
620
|
+
* If the test uses callbacks, the callback function is passed as the second argument.
|
|
581
621
|
* @returns A {@link Promise} resolved with `undefined` once the test completes.
|
|
582
622
|
*/
|
|
583
623
|
test: typeof test;
|
|
@@ -586,6 +626,140 @@ declare module "node:test" {
|
|
|
586
626
|
*/
|
|
587
627
|
readonly mock: MockTracker;
|
|
588
628
|
}
|
|
629
|
+
interface TestContextAssert {
|
|
630
|
+
/**
|
|
631
|
+
* Identical to the `deepEqual` function from the `node:assert` module, but bound to the test context.
|
|
632
|
+
*/
|
|
633
|
+
deepEqual: typeof import("node:assert").deepEqual;
|
|
634
|
+
/**
|
|
635
|
+
* Identical to the `deepStrictEqual` function from the `node:assert` module, but bound to the test context.
|
|
636
|
+
*
|
|
637
|
+
* **Note:** as this method returns a type assertion, the context parameter in the callback signature must have a
|
|
638
|
+
* type annotation, otherwise an error will be raised by the TypeScript compiler:
|
|
639
|
+
* ```ts
|
|
640
|
+
* import { test, type TestContext } from 'node:test';
|
|
641
|
+
*
|
|
642
|
+
* // The test function's context parameter must have a type annotation.
|
|
643
|
+
* test('example', (t: TestContext) => {
|
|
644
|
+
* t.assert.deepStrictEqual(actual, expected);
|
|
645
|
+
* });
|
|
646
|
+
*
|
|
647
|
+
* // Omitting the type annotation will result in a compilation error.
|
|
648
|
+
* test('example', t => {
|
|
649
|
+
* t.assert.deepStrictEqual(actual, expected); // Error: 't' needs an explicit type annotation.
|
|
650
|
+
* });
|
|
651
|
+
* ```
|
|
652
|
+
*/
|
|
653
|
+
deepStrictEqual: typeof import("node:assert").deepStrictEqual;
|
|
654
|
+
/**
|
|
655
|
+
* Identical to the `doesNotMatch` function from the `node:assert` module, but bound to the test context.
|
|
656
|
+
*/
|
|
657
|
+
doesNotMatch: typeof import("node:assert").doesNotMatch;
|
|
658
|
+
/**
|
|
659
|
+
* Identical to the `doesNotReject` function from the `node:assert` module, but bound to the test context.
|
|
660
|
+
*/
|
|
661
|
+
doesNotReject: typeof import("node:assert").doesNotReject;
|
|
662
|
+
/**
|
|
663
|
+
* Identical to the `doesNotThrow` function from the `node:assert` module, but bound to the test context.
|
|
664
|
+
*/
|
|
665
|
+
doesNotThrow: typeof import("node:assert").doesNotThrow;
|
|
666
|
+
/**
|
|
667
|
+
* Identical to the `equal` function from the `node:assert` module, but bound to the test context.
|
|
668
|
+
*/
|
|
669
|
+
equal: typeof import("node:assert").equal;
|
|
670
|
+
/**
|
|
671
|
+
* Identical to the `fail` function from the `node:assert` module, but bound to the test context.
|
|
672
|
+
*/
|
|
673
|
+
fail: typeof import("node:assert").fail;
|
|
674
|
+
/**
|
|
675
|
+
* Identical to the `ifError` function from the `node:assert` module, but bound to the test context.
|
|
676
|
+
*
|
|
677
|
+
* **Note:** as this method returns a type assertion, the context parameter in the callback signature must have a
|
|
678
|
+
* type annotation, otherwise an error will be raised by the TypeScript compiler:
|
|
679
|
+
* ```ts
|
|
680
|
+
* import { test, type TestContext } from 'node:test';
|
|
681
|
+
*
|
|
682
|
+
* // The test function's context parameter must have a type annotation.
|
|
683
|
+
* test('example', (t: TestContext) => {
|
|
684
|
+
* t.assert.ifError(err);
|
|
685
|
+
* });
|
|
686
|
+
*
|
|
687
|
+
* // Omitting the type annotation will result in a compilation error.
|
|
688
|
+
* test('example', t => {
|
|
689
|
+
* t.assert.ifError(err); // Error: 't' needs an explicit type annotation.
|
|
690
|
+
* });
|
|
691
|
+
* ```
|
|
692
|
+
*/
|
|
693
|
+
ifError: typeof import("node:assert").ifError;
|
|
694
|
+
/**
|
|
695
|
+
* Identical to the `match` function from the `node:assert` module, but bound to the test context.
|
|
696
|
+
*/
|
|
697
|
+
match: typeof import("node:assert").match;
|
|
698
|
+
/**
|
|
699
|
+
* Identical to the `notDeepEqual` function from the `node:assert` module, but bound to the test context.
|
|
700
|
+
*/
|
|
701
|
+
notDeepEqual: typeof import("node:assert").notDeepEqual;
|
|
702
|
+
/**
|
|
703
|
+
* Identical to the `notDeepStrictEqual` function from the `node:assert` module, but bound to the test context.
|
|
704
|
+
*/
|
|
705
|
+
notDeepStrictEqual: typeof import("node:assert").notDeepStrictEqual;
|
|
706
|
+
/**
|
|
707
|
+
* Identical to the `notEqual` function from the `node:assert` module, but bound to the test context.
|
|
708
|
+
*/
|
|
709
|
+
notEqual: typeof import("node:assert").notEqual;
|
|
710
|
+
/**
|
|
711
|
+
* Identical to the `notStrictEqual` function from the `node:assert` module, but bound to the test context.
|
|
712
|
+
*/
|
|
713
|
+
notStrictEqual: typeof import("node:assert").notStrictEqual;
|
|
714
|
+
/**
|
|
715
|
+
* Identical to the `ok` function from the `node:assert` module, but bound to the test context.
|
|
716
|
+
*
|
|
717
|
+
* **Note:** as this method returns a type assertion, the context parameter in the callback signature must have a
|
|
718
|
+
* type annotation, otherwise an error will be raised by the TypeScript compiler:
|
|
719
|
+
* ```ts
|
|
720
|
+
* import { test, type TestContext } from 'node:test';
|
|
721
|
+
*
|
|
722
|
+
* // The test function's context parameter must have a type annotation.
|
|
723
|
+
* test('example', (t: TestContext) => {
|
|
724
|
+
* t.assert.ok(condition);
|
|
725
|
+
* });
|
|
726
|
+
*
|
|
727
|
+
* // Omitting the type annotation will result in a compilation error.
|
|
728
|
+
* test('example', t => {
|
|
729
|
+
* t.assert.ok(condition)); // Error: 't' needs an explicit type annotation.
|
|
730
|
+
* });
|
|
731
|
+
* ```
|
|
732
|
+
*/
|
|
733
|
+
ok: typeof import("node:assert").ok;
|
|
734
|
+
/**
|
|
735
|
+
* Identical to the `rejects` function from the `node:assert` module, but bound to the test context.
|
|
736
|
+
*/
|
|
737
|
+
rejects: typeof import("node:assert").rejects;
|
|
738
|
+
/**
|
|
739
|
+
* Identical to the `strictEqual` function from the `node:assert` module, but bound to the test context.
|
|
740
|
+
*
|
|
741
|
+
* **Note:** as this method returns a type assertion, the context parameter in the callback signature must have a
|
|
742
|
+
* type annotation, otherwise an error will be raised by the TypeScript compiler:
|
|
743
|
+
* ```ts
|
|
744
|
+
* import { test, type TestContext } from 'node:test';
|
|
745
|
+
*
|
|
746
|
+
* // The test function's context parameter must have a type annotation.
|
|
747
|
+
* test('example', (t: TestContext) => {
|
|
748
|
+
* t.assert.strictEqual(actual, expected);
|
|
749
|
+
* });
|
|
750
|
+
*
|
|
751
|
+
* // Omitting the type annotation will result in a compilation error.
|
|
752
|
+
* test('example', t => {
|
|
753
|
+
* t.assert.strictEqual(actual, expected); // Error: 't' needs an explicit type annotation.
|
|
754
|
+
* });
|
|
755
|
+
* ```
|
|
756
|
+
*/
|
|
757
|
+
strictEqual: typeof import("node:assert").strictEqual;
|
|
758
|
+
/**
|
|
759
|
+
* Identical to the `throws` function from the `node:assert` module, but bound to the test context.
|
|
760
|
+
*/
|
|
761
|
+
throws: typeof import("node:assert").throws;
|
|
762
|
+
}
|
|
589
763
|
|
|
590
764
|
/**
|
|
591
765
|
* An instance of `SuiteContext` is passed to each suite function in order to
|
|
@@ -645,6 +819,14 @@ declare module "node:test" {
|
|
|
645
819
|
* @default false
|
|
646
820
|
*/
|
|
647
821
|
todo?: boolean | string | undefined;
|
|
822
|
+
/**
|
|
823
|
+
* The number of assertions and subtests expected to be run in the test.
|
|
824
|
+
* If the number of assertions run in the test does not match the number
|
|
825
|
+
* specified in the plan, the test will fail.
|
|
826
|
+
* @default undefined
|
|
827
|
+
* @since v20.15.0
|
|
828
|
+
*/
|
|
829
|
+
plan?: number | undefined;
|
|
648
830
|
}
|
|
649
831
|
/**
|
|
650
832
|
* This function creates a hook that runs before executing a suite.
|
|
@@ -658,8 +840,8 @@ declare module "node:test" {
|
|
|
658
840
|
* });
|
|
659
841
|
* ```
|
|
660
842
|
* @since v18.8.0, v16.18.0
|
|
661
|
-
* @param
|
|
662
|
-
* @param options Configuration options for the hook.
|
|
843
|
+
* @param fn The hook function. If the hook uses callbacks, the callback function is passed as the second argument.
|
|
844
|
+
* @param options Configuration options for the hook.
|
|
663
845
|
*/
|
|
664
846
|
function before(fn?: HookFn, options?: HookOptions): void;
|
|
665
847
|
/**
|
|
@@ -674,8 +856,8 @@ declare module "node:test" {
|
|
|
674
856
|
* });
|
|
675
857
|
* ```
|
|
676
858
|
* @since v18.8.0, v16.18.0
|
|
677
|
-
* @param
|
|
678
|
-
* @param options Configuration options for the hook.
|
|
859
|
+
* @param fn The hook function. If the hook uses callbacks, the callback function is passed as the second argument.
|
|
860
|
+
* @param options Configuration options for the hook.
|
|
679
861
|
*/
|
|
680
862
|
function after(fn?: HookFn, options?: HookOptions): void;
|
|
681
863
|
/**
|
|
@@ -690,8 +872,8 @@ declare module "node:test" {
|
|
|
690
872
|
* });
|
|
691
873
|
* ```
|
|
692
874
|
* @since v18.8.0, v16.18.0
|
|
693
|
-
* @param
|
|
694
|
-
* @param options Configuration options for the hook.
|
|
875
|
+
* @param fn The hook function. If the hook uses callbacks, the callback function is passed as the second argument.
|
|
876
|
+
* @param options Configuration options for the hook.
|
|
695
877
|
*/
|
|
696
878
|
function beforeEach(fn?: HookFn, options?: HookOptions): void;
|
|
697
879
|
/**
|
|
@@ -707,15 +889,20 @@ declare module "node:test" {
|
|
|
707
889
|
* });
|
|
708
890
|
* ```
|
|
709
891
|
* @since v18.8.0, v16.18.0
|
|
710
|
-
* @param
|
|
711
|
-
* @param options Configuration options for the hook.
|
|
892
|
+
* @param fn The hook function. If the hook uses callbacks, the callback function is passed as the second argument.
|
|
893
|
+
* @param options Configuration options for the hook.
|
|
712
894
|
*/
|
|
713
895
|
function afterEach(fn?: HookFn, options?: HookOptions): void;
|
|
714
896
|
/**
|
|
715
|
-
* The hook function.
|
|
716
|
-
* second argument.
|
|
897
|
+
* The hook function. The first argument is the context in which the hook is called.
|
|
898
|
+
* If the hook uses callbacks, the callback function is passed as the second argument.
|
|
899
|
+
*/
|
|
900
|
+
type HookFn = (c: TestContext | SuiteContext, done: (result?: any) => void) => any;
|
|
901
|
+
/**
|
|
902
|
+
* The hook function. The first argument is a `TestContext` object.
|
|
903
|
+
* If the hook uses callbacks, the callback function is passed as the second argument.
|
|
717
904
|
*/
|
|
718
|
-
type
|
|
905
|
+
type TestContextHookFn = (t: TestContext, done: (result?: any) => void) => any;
|
|
719
906
|
/**
|
|
720
907
|
* Configuration options for hooks.
|
|
721
908
|
* @since v18.8.0
|
|
@@ -798,10 +985,10 @@ declare module "node:test" {
|
|
|
798
985
|
* });
|
|
799
986
|
* ```
|
|
800
987
|
* @since v19.1.0, v18.13.0
|
|
801
|
-
* @param
|
|
988
|
+
* @param original An optional function to create a mock on.
|
|
802
989
|
* @param implementation An optional function used as the mock implementation for `original`. This is useful for creating mocks that exhibit one behavior for a specified number of calls and
|
|
803
990
|
* then restore the behavior of `original`.
|
|
804
|
-
* @param options Optional configuration options for the mock function.
|
|
991
|
+
* @param options Optional configuration options for the mock function.
|
|
805
992
|
* @return The mocked function. The mocked function contains a special `mock` property, which is an instance of {@link MockFunctionContext}, and can be used for inspecting and changing the
|
|
806
993
|
* behavior of the mocked function.
|
|
807
994
|
*/
|
|
@@ -843,7 +1030,7 @@ declare module "node:test" {
|
|
|
843
1030
|
* @param object The object whose method is being mocked.
|
|
844
1031
|
* @param methodName The identifier of the method on `object` to mock. If `object[methodName]` is not a function, an error is thrown.
|
|
845
1032
|
* @param implementation An optional function used as the mock implementation for `object[methodName]`.
|
|
846
|
-
* @param options Optional configuration options for the mock method.
|
|
1033
|
+
* @param options Optional configuration options for the mock method.
|
|
847
1034
|
* @return The mocked method. The mocked method contains a special `mock` property, which is an instance of {@link MockFunctionContext}, and can be used for inspecting and changing the
|
|
848
1035
|
* behavior of the mocked method.
|
|
849
1036
|
*/
|
|
@@ -1085,7 +1272,7 @@ declare module "node:test" {
|
|
|
1085
1272
|
|
|
1086
1273
|
interface MockTimersOptions {
|
|
1087
1274
|
apis: Timer[];
|
|
1088
|
-
now?: number | Date;
|
|
1275
|
+
now?: number | Date | undefined;
|
|
1089
1276
|
}
|
|
1090
1277
|
/**
|
|
1091
1278
|
* Mocking timers is a technique commonly used in software testing to simulate and
|
|
@@ -1324,6 +1511,9 @@ declare module "node:test" {
|
|
|
1324
1511
|
};
|
|
1325
1512
|
}
|
|
1326
1513
|
|
|
1514
|
+
interface TestError extends Error {
|
|
1515
|
+
cause: Error;
|
|
1516
|
+
}
|
|
1327
1517
|
interface TestLocationInfo {
|
|
1328
1518
|
/**
|
|
1329
1519
|
* The column number where the test is defined, or
|
|
@@ -1355,7 +1545,7 @@ interface TestCoverage {
|
|
|
1355
1545
|
*/
|
|
1356
1546
|
summary: {
|
|
1357
1547
|
/**
|
|
1358
|
-
* An array of coverage reports for individual files.
|
|
1548
|
+
* An array of coverage reports for individual files.
|
|
1359
1549
|
*/
|
|
1360
1550
|
files: Array<{
|
|
1361
1551
|
/**
|
|
@@ -1415,6 +1605,19 @@ interface TestCoverage {
|
|
|
1415
1605
|
*/
|
|
1416
1606
|
count: number;
|
|
1417
1607
|
}>;
|
|
1608
|
+
/**
|
|
1609
|
+
* An array of branches representing branch coverage.
|
|
1610
|
+
*/
|
|
1611
|
+
branches: Array<{
|
|
1612
|
+
/**
|
|
1613
|
+
* The line number where the branch is defined.
|
|
1614
|
+
*/
|
|
1615
|
+
line: number;
|
|
1616
|
+
/**
|
|
1617
|
+
* The number of times the branch was taken.
|
|
1618
|
+
*/
|
|
1619
|
+
count: number;
|
|
1620
|
+
}>;
|
|
1418
1621
|
/**
|
|
1419
1622
|
* An array of lines representing line numbers and the number of times they were covered.
|
|
1420
1623
|
*/
|
|
@@ -1498,7 +1701,7 @@ interface TestComplete extends TestLocationInfo {
|
|
|
1498
1701
|
/**
|
|
1499
1702
|
* An error wrapping the error thrown by the test if it did not pass.
|
|
1500
1703
|
*/
|
|
1501
|
-
error
|
|
1704
|
+
error?: TestError;
|
|
1502
1705
|
/**
|
|
1503
1706
|
* The type of the test, used to denote whether this is a suite.
|
|
1504
1707
|
*/
|
|
@@ -1555,9 +1758,9 @@ interface TestFail extends TestLocationInfo {
|
|
|
1555
1758
|
*/
|
|
1556
1759
|
duration_ms: number;
|
|
1557
1760
|
/**
|
|
1558
|
-
* An error wrapping the error thrown by the test
|
|
1761
|
+
* An error wrapping the error thrown by the test.
|
|
1559
1762
|
*/
|
|
1560
|
-
error:
|
|
1763
|
+
error: TestError;
|
|
1561
1764
|
/**
|
|
1562
1765
|
* The type of the test, used to denote whether this is a suite.
|
|
1563
1766
|
* @since v20.0.0, v19.9.0, v18.17.0
|
|
@@ -1641,13 +1844,21 @@ interface TestStart extends TestLocationInfo {
|
|
|
1641
1844
|
*/
|
|
1642
1845
|
nesting: number;
|
|
1643
1846
|
}
|
|
1644
|
-
interface TestStderr
|
|
1847
|
+
interface TestStderr {
|
|
1848
|
+
/**
|
|
1849
|
+
* The path of the test file.
|
|
1850
|
+
*/
|
|
1851
|
+
file: string;
|
|
1645
1852
|
/**
|
|
1646
1853
|
* The message written to `stderr`.
|
|
1647
1854
|
*/
|
|
1648
1855
|
message: string;
|
|
1649
1856
|
}
|
|
1650
|
-
interface TestStdout
|
|
1857
|
+
interface TestStdout {
|
|
1858
|
+
/**
|
|
1859
|
+
* The path of the test file.
|
|
1860
|
+
*/
|
|
1861
|
+
file: string;
|
|
1651
1862
|
/**
|
|
1652
1863
|
* The message written to `stdout`.
|
|
1653
1864
|
*/
|
|
@@ -1686,34 +1897,42 @@ declare module "node:test/reporters" {
|
|
|
1686
1897
|
| { type: "test:start"; data: TestStart }
|
|
1687
1898
|
| { type: "test:stderr"; data: TestStderr }
|
|
1688
1899
|
| { type: "test:stdout"; data: TestStdout }
|
|
1689
|
-
| { type: "test:watch:drained" };
|
|
1900
|
+
| { type: "test:watch:drained"; data: undefined };
|
|
1690
1901
|
type TestEventGenerator = AsyncGenerator<TestEvent, void>;
|
|
1691
1902
|
|
|
1692
1903
|
/**
|
|
1693
1904
|
* The `dot` reporter outputs the test results in a compact format,
|
|
1694
1905
|
* where each passing test is represented by a `.`,
|
|
1695
1906
|
* and each failing test is represented by a `X`.
|
|
1907
|
+
* @since v20.0.0
|
|
1696
1908
|
*/
|
|
1697
1909
|
function dot(source: TestEventGenerator): AsyncGenerator<"\n" | "." | "X", void>;
|
|
1698
1910
|
/**
|
|
1699
1911
|
* The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format.
|
|
1912
|
+
* @since v20.0.0
|
|
1700
1913
|
*/
|
|
1701
1914
|
function tap(source: TestEventGenerator): AsyncGenerator<string, void>;
|
|
1702
1915
|
/**
|
|
1703
1916
|
* The `spec` reporter outputs the test results in a human-readable format.
|
|
1917
|
+
* @since v20.0.0
|
|
1704
1918
|
*/
|
|
1705
|
-
class
|
|
1919
|
+
class SpecReporter extends Transform {
|
|
1706
1920
|
constructor();
|
|
1707
1921
|
}
|
|
1708
1922
|
/**
|
|
1709
1923
|
* The `junit` reporter outputs test results in a jUnit XML format.
|
|
1924
|
+
* @since v21.0.0
|
|
1710
1925
|
*/
|
|
1711
1926
|
function junit(source: TestEventGenerator): AsyncGenerator<string, void>;
|
|
1927
|
+
class LcovReporter extends Transform {
|
|
1928
|
+
constructor(opts?: Omit<TransformOptions, "writableObjectMode">);
|
|
1929
|
+
}
|
|
1712
1930
|
/**
|
|
1713
|
-
* The `lcov` reporter outputs test coverage when used with the
|
|
1931
|
+
* The `lcov` reporter outputs test coverage when used with the
|
|
1932
|
+
* [`--experimental-test-coverage`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--experimental-test-coverage) flag.
|
|
1933
|
+
* @since v22.0.0
|
|
1714
1934
|
*/
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
}
|
|
1718
|
-
export { dot, junit, Lcov as lcov, Spec as spec, tap, TestEvent };
|
|
1935
|
+
const lcov: LcovReporter;
|
|
1936
|
+
|
|
1937
|
+
export { dot, junit, lcov, SpecReporter as spec, tap, TestEvent };
|
|
1719
1938
|
}
|