@types/node 20.12.14 → 20.14.0
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.
- node/README.md +1 -1
- node/assert.d.ts +1 -1
- node/async_hooks.d.ts +1 -1
- node/buffer.d.ts +23 -23
- node/child_process.d.ts +34 -32
- node/cluster.d.ts +1 -1
- node/console.d.ts +1 -1
- node/crypto.d.ts +60 -59
- node/dgram.d.ts +2 -2
- node/diagnostics_channel.d.ts +10 -1
- node/dns/promises.d.ts +7 -6
- node/dns.d.ts +23 -12
- node/domain.d.ts +1 -1
- node/events.d.ts +22 -2
- node/fs.d.ts +2 -2
- node/http.d.ts +62 -43
- node/http2.d.ts +1 -1
- node/https.d.ts +3 -3
- node/inspector.d.ts +1 -1
- node/net.d.ts +8 -5
- node/os.d.ts +2 -2
- node/package.json +2 -2
- node/path.d.ts +1 -1
- node/perf_hooks.d.ts +306 -46
- node/process.d.ts +12 -5
- node/punycode.d.ts +1 -1
- node/querystring.d.ts +1 -1
- node/readline.d.ts +1 -1
- node/repl.d.ts +4 -4
- node/stream.d.ts +15 -15
- node/string_decoder.d.ts +1 -1
- node/test.d.ts +322 -74
- node/timers.d.ts +1 -1
- node/tls.d.ts +1 -1
- node/trace_events.d.ts +1 -1
- node/tty.d.ts +1 -1
- node/url.d.ts +11 -3
- node/util.d.ts +20 -4
- node/v8.d.ts +45 -1
- node/vm.d.ts +9 -6
- node/wasi.d.ts +1 -1
- node/worker_threads.d.ts +1 -1
- node/zlib.d.ts +1 -1
node/test.d.ts
CHANGED
@@ -76,7 +76,7 @@
|
|
76
76
|
*
|
77
77
|
* If any tests fail, the process exit code is set to `1`.
|
78
78
|
* @since v18.0.0, v16.17.0
|
79
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.
|
79
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/test.js)
|
80
80
|
*/
|
81
81
|
declare module "node:test" {
|
82
82
|
import { Readable } from "node:stream";
|
@@ -110,7 +110,7 @@ declare module "node:test" {
|
|
110
110
|
* additional diagnostic information, or creating subtests.
|
111
111
|
*
|
112
112
|
* `test()` returns a `Promise` that fulfills once the test completes.
|
113
|
-
* if `test()` is called within a
|
113
|
+
* if `test()` is called within a suite, it fulfills immediately.
|
114
114
|
* The return value can usually be discarded for top level tests.
|
115
115
|
* However, the return value from subtests should be used to prevent the parent
|
116
116
|
* test from finishing first and cancelling the subtest
|
@@ -137,7 +137,7 @@ declare module "node:test" {
|
|
137
137
|
* @param options Configuration options for the test. The following properties are supported:
|
138
138
|
* @param [fn='A no-op function'] The function under test. The first argument to this function is a {@link TestContext} object. If the test uses callbacks, the
|
139
139
|
* callback function is passed as the second argument.
|
140
|
-
* @return Fulfilled with `undefined` once the test completes, or immediately if the test runs within
|
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>;
|
143
143
|
function test(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
@@ -147,14 +147,47 @@ declare module "node:test" {
|
|
147
147
|
export { after, afterEach, before, beforeEach, describe, it, mock, only, run, skip, test, todo };
|
148
148
|
}
|
149
149
|
/**
|
150
|
-
* The `
|
151
|
-
*
|
152
|
-
*
|
153
|
-
*
|
154
|
-
* @param [name='The name'] The name of the suite, which is displayed when reporting test results.
|
155
|
-
* @param options Configuration options for the suite. supports the same options as `test([name][, options][, fn])`.
|
156
|
-
* @param [fn='A no-op function'] The function under suite declaring all subtests and subsuites. The first argument to this function is a {@link SuiteContext} object.
|
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. **Default:** The `name` property of `fn`, or `'<anonymous>'` if `fn` does not have a name.
|
152
|
+
* @param options Optional configuration options for the suite. This supports the same options as `test([name][, options][, fn])`.
|
153
|
+
* @param [fn='A no-op function'] The suite function declaring nested tests and suites. The first argument to this function is a `{@link SuiteContext}` object.
|
157
154
|
* @return Immediately fulfilled with `undefined`.
|
155
|
+
* @since v20.13.0
|
156
|
+
*/
|
157
|
+
function suite(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
158
|
+
function suite(name?: string, fn?: SuiteFn): Promise<void>;
|
159
|
+
function suite(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
160
|
+
function suite(fn?: SuiteFn): Promise<void>;
|
161
|
+
namespace suite {
|
162
|
+
/**
|
163
|
+
* Shorthand for skipping a suite. This is the same as [`suite([name], { skip: true }[, fn])`](https://nodejs.org/docs/latest-v20.x/api/test.html#suitename-options-fn).
|
164
|
+
* @since v20.13.0
|
165
|
+
*/
|
166
|
+
function skip(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
167
|
+
function skip(name?: string, fn?: SuiteFn): Promise<void>;
|
168
|
+
function skip(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
169
|
+
function skip(fn?: SuiteFn): Promise<void>;
|
170
|
+
/**
|
171
|
+
* Shorthand for marking a suite as `TODO`. This is the same as [`suite([name], { todo: true }[, fn])`](https://nodejs.org/docs/latest-v20.x/api/test.html#suitename-options-fn).
|
172
|
+
* @since v20.13.0
|
173
|
+
*/
|
174
|
+
function todo(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
175
|
+
function todo(name?: string, fn?: SuiteFn): Promise<void>;
|
176
|
+
function todo(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
177
|
+
function todo(fn?: SuiteFn): Promise<void>;
|
178
|
+
/**
|
179
|
+
* Shorthand for marking a suite as `only`. This is the same as [`suite([name], { only: true }[, fn])`](https://nodejs.org/docs/latest-v20.x/api/test.html#suitename-options-fn).
|
180
|
+
* @since v20.13.0
|
181
|
+
*/
|
182
|
+
function only(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
183
|
+
function only(name?: string, fn?: SuiteFn): Promise<void>;
|
184
|
+
function only(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
185
|
+
function only(fn?: SuiteFn): Promise<void>;
|
186
|
+
}
|
187
|
+
/**
|
188
|
+
* Alias for `{@link suite}`.
|
189
|
+
*
|
190
|
+
* The `describe()` function is imported from the `node:test` module.
|
158
191
|
*/
|
159
192
|
function describe(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
160
193
|
function describe(name?: string, fn?: SuiteFn): Promise<void>;
|
@@ -162,21 +195,23 @@ declare module "node:test" {
|
|
162
195
|
function describe(fn?: SuiteFn): Promise<void>;
|
163
196
|
namespace describe {
|
164
197
|
/**
|
165
|
-
* Shorthand for skipping a suite
|
198
|
+
* Shorthand for skipping a suite. This is the same as [`describe([name], { skip: true }[, fn])`](https://nodejs.org/docs/latest-v20.x/api/test.html#describename-options-fn).
|
199
|
+
* @since v18.15.0
|
166
200
|
*/
|
167
201
|
function skip(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
168
202
|
function skip(name?: string, fn?: SuiteFn): Promise<void>;
|
169
203
|
function skip(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
170
204
|
function skip(fn?: SuiteFn): Promise<void>;
|
171
205
|
/**
|
172
|
-
* Shorthand for marking a suite as `TODO
|
206
|
+
* Shorthand for marking a suite as `TODO`. This is the same as [`describe([name], { todo: true }[, fn])`](https://nodejs.org/docs/latest-v20.x/api/test.html#describename-options-fn).
|
207
|
+
* @since v18.15.0
|
173
208
|
*/
|
174
209
|
function todo(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
175
210
|
function todo(name?: string, fn?: SuiteFn): Promise<void>;
|
176
211
|
function todo(options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
177
212
|
function todo(fn?: SuiteFn): Promise<void>;
|
178
213
|
/**
|
179
|
-
* Shorthand for marking a suite as `only
|
214
|
+
* Shorthand for marking a suite as `only`. This is the same as [`describe([name], { only: true }[, fn])`](https://nodejs.org/docs/latest-v20.x/api/test.html#describename-options-fn).
|
180
215
|
* @since v18.15.0
|
181
216
|
*/
|
182
217
|
function only(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
|
@@ -185,7 +220,7 @@ declare module "node:test" {
|
|
185
220
|
function only(fn?: SuiteFn): Promise<void>;
|
186
221
|
}
|
187
222
|
/**
|
188
|
-
*
|
223
|
+
* Alias for `test()`.
|
189
224
|
*
|
190
225
|
* The `it()` function is imported from the `node:test` module.
|
191
226
|
* @since v18.6.0, v16.17.0
|
@@ -264,49 +299,57 @@ declare module "node:test" {
|
|
264
299
|
}
|
265
300
|
interface RunOptions {
|
266
301
|
/**
|
267
|
-
* If a number is provided, then that many
|
268
|
-
* If
|
269
|
-
*
|
270
|
-
* If unspecified, subtests inherit this value from their parent.
|
271
|
-
* @default true
|
302
|
+
* If a number is provided, then that many test processes would run in parallel, where each process corresponds to one test file.
|
303
|
+
* If `true`, it would run `os.availableParallelism() - 1` test files in parallel. If `false`, it would only run one test file at a time.
|
304
|
+
* @default false
|
272
305
|
*/
|
273
306
|
concurrency?: number | boolean | undefined;
|
274
307
|
/**
|
275
|
-
* An array containing the list of files to run.
|
276
|
-
*
|
308
|
+
* An array containing the list of files to run. **Default** matching files from
|
309
|
+
* [test runner execution model](https://nodejs.org/docs/latest-v20.x/api/test.html#test-runner-execution-model).
|
277
310
|
*/
|
278
311
|
files?: readonly string[] | undefined;
|
279
312
|
/**
|
280
|
-
*
|
281
|
-
*
|
282
|
-
|
283
|
-
|
284
|
-
/**
|
285
|
-
* A number of milliseconds the test will fail after.
|
286
|
-
* If unspecified, subtests inherit this value from their parent.
|
287
|
-
* @default Infinity
|
313
|
+
* Configures the test runner to exit the process once all known
|
314
|
+
* tests have finished executing even if the event loop would
|
315
|
+
* otherwise remain active.
|
316
|
+
* @default false
|
288
317
|
*/
|
289
|
-
|
318
|
+
forceExit?: boolean | undefined;
|
290
319
|
/**
|
291
320
|
* Sets inspector port of test child process.
|
292
321
|
* If a nullish value is provided, each process gets its own port,
|
293
322
|
* incremented from the primary's `process.debugPort`.
|
323
|
+
* @default undefined
|
294
324
|
*/
|
295
325
|
inspectPort?: number | (() => number) | undefined;
|
296
|
-
/**
|
297
|
-
* That can be used to only run tests whose name matches the provided pattern.
|
298
|
-
* Test name patterns are interpreted as JavaScript regular expressions.
|
299
|
-
* For each test that is executed, any corresponding test hooks, such as `beforeEach()`, are also run.
|
300
|
-
*/
|
301
|
-
testNamePatterns?: string | RegExp | string[] | RegExp[];
|
302
326
|
/**
|
303
327
|
* If truthy, the test context will only run tests that have the `only` option set
|
304
328
|
*/
|
305
329
|
only?: boolean;
|
306
330
|
/**
|
307
|
-
* A function that accepts the TestsStream instance and can be used to setup listeners before any tests are run.
|
331
|
+
* A function that accepts the `TestsStream` instance and can be used to setup listeners before any tests are run.
|
332
|
+
* @default undefined
|
308
333
|
*/
|
309
334
|
setup?: (root: Test) => void | Promise<void>;
|
335
|
+
/**
|
336
|
+
* Allows aborting an in-progress test execution.
|
337
|
+
*/
|
338
|
+
signal?: AbortSignal | undefined;
|
339
|
+
/**
|
340
|
+
* A String, RegExp or a RegExp Array, that can be used to only run tests whose
|
341
|
+
* name matches the provided pattern. Test name patterns are interpreted as JavaScript
|
342
|
+
* regular expressions. For each test that is executed, any corresponding test hooks,
|
343
|
+
* such as `beforeEach()`, are also run.
|
344
|
+
* @default undefined
|
345
|
+
*/
|
346
|
+
testNamePatterns?: string | RegExp | string[] | RegExp[];
|
347
|
+
/**
|
348
|
+
* A number of milliseconds the test execution will fail after.
|
349
|
+
* If unspecified, subtests inherit this value from their parent.
|
350
|
+
* @default Infinity
|
351
|
+
*/
|
352
|
+
timeout?: number | undefined;
|
310
353
|
/**
|
311
354
|
* Whether to run in watch mode or not.
|
312
355
|
* @default false
|
@@ -330,10 +373,16 @@ declare module "node:test" {
|
|
330
373
|
/**
|
331
374
|
* A successful call to `run()` method will return a new `TestsStream` object, streaming a series of events representing the execution of the tests. `TestsStream` will emit events, in the
|
332
375
|
* order of the tests definition
|
376
|
+
*
|
377
|
+
* 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.
|
333
378
|
* @since v18.9.0, v16.19.0
|
334
379
|
*/
|
335
380
|
class TestsStream extends Readable implements NodeJS.ReadableStream {
|
381
|
+
addListener(event: "test:coverage", listener: (data: TestCoverage) => void): this;
|
382
|
+
addListener(event: "test:complete", listener: (data: TestComplete) => void): this;
|
383
|
+
addListener(event: "test:dequeue", listener: (data: TestDequeue) => void): this;
|
336
384
|
addListener(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this;
|
385
|
+
addListener(event: "test:enqueue", listener: (data: TestEnqueue) => void): this;
|
337
386
|
addListener(event: "test:fail", listener: (data: TestFail) => void): this;
|
338
387
|
addListener(event: "test:pass", listener: (data: TestPass) => void): this;
|
339
388
|
addListener(event: "test:plan", listener: (data: TestPlan) => void): this;
|
@@ -341,7 +390,11 @@ declare module "node:test" {
|
|
341
390
|
addListener(event: "test:stderr", listener: (data: TestStderr) => void): this;
|
342
391
|
addListener(event: "test:stdout", listener: (data: TestStdout) => void): this;
|
343
392
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
393
|
+
emit(event: "test:coverage", data: TestCoverage): boolean;
|
394
|
+
emit(event: "test:complete", data: TestComplete): boolean;
|
395
|
+
emit(event: "test:dequeue", data: TestDequeue): boolean;
|
344
396
|
emit(event: "test:diagnostic", data: DiagnosticData): boolean;
|
397
|
+
emit(event: "test:enqueue", data: TestEnqueue): boolean;
|
345
398
|
emit(event: "test:fail", data: TestFail): boolean;
|
346
399
|
emit(event: "test:pass", data: TestPass): boolean;
|
347
400
|
emit(event: "test:plan", data: TestPlan): boolean;
|
@@ -349,7 +402,11 @@ declare module "node:test" {
|
|
349
402
|
emit(event: "test:stderr", data: TestStderr): boolean;
|
350
403
|
emit(event: "test:stdout", data: TestStdout): boolean;
|
351
404
|
emit(event: string | symbol, ...args: any[]): boolean;
|
405
|
+
on(event: "test:coverage", listener: (data: TestCoverage) => void): this;
|
406
|
+
on(event: "test:complete", listener: (data: TestComplete) => void): this;
|
407
|
+
on(event: "test:dequeue", listener: (data: TestDequeue) => void): this;
|
352
408
|
on(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this;
|
409
|
+
on(event: "test:enqueue", listener: (data: TestEnqueue) => void): this;
|
353
410
|
on(event: "test:fail", listener: (data: TestFail) => void): this;
|
354
411
|
on(event: "test:pass", listener: (data: TestPass) => void): this;
|
355
412
|
on(event: "test:plan", listener: (data: TestPlan) => void): this;
|
@@ -357,7 +414,11 @@ declare module "node:test" {
|
|
357
414
|
on(event: "test:stderr", listener: (data: TestStderr) => void): this;
|
358
415
|
on(event: "test:stdout", listener: (data: TestStdout) => void): this;
|
359
416
|
on(event: string, listener: (...args: any[]) => void): this;
|
417
|
+
once(event: "test:coverage", listener: (data: TestCoverage) => void): this;
|
418
|
+
once(event: "test:complete", listener: (data: TestComplete) => void): this;
|
419
|
+
once(event: "test:dequeue", listener: (data: TestDequeue) => void): this;
|
360
420
|
once(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this;
|
421
|
+
once(event: "test:enqueue", listener: (data: TestEnqueue) => void): this;
|
361
422
|
once(event: "test:fail", listener: (data: TestFail) => void): this;
|
362
423
|
once(event: "test:pass", listener: (data: TestPass) => void): this;
|
363
424
|
once(event: "test:plan", listener: (data: TestPlan) => void): this;
|
@@ -365,7 +426,11 @@ declare module "node:test" {
|
|
365
426
|
once(event: "test:stderr", listener: (data: TestStderr) => void): this;
|
366
427
|
once(event: "test:stdout", listener: (data: TestStdout) => void): this;
|
367
428
|
once(event: string, listener: (...args: any[]) => void): this;
|
429
|
+
prependListener(event: "test:coverage", listener: (data: TestCoverage) => void): this;
|
430
|
+
prependListener(event: "test:complete", listener: (data: TestComplete) => void): this;
|
431
|
+
prependListener(event: "test:dequeue", listener: (data: TestDequeue) => void): this;
|
368
432
|
prependListener(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this;
|
433
|
+
prependListener(event: "test:enqueue", listener: (data: TestEnqueue) => void): this;
|
369
434
|
prependListener(event: "test:fail", listener: (data: TestFail) => void): this;
|
370
435
|
prependListener(event: "test:pass", listener: (data: TestPass) => void): this;
|
371
436
|
prependListener(event: "test:plan", listener: (data: TestPlan) => void): this;
|
@@ -373,7 +438,11 @@ declare module "node:test" {
|
|
373
438
|
prependListener(event: "test:stderr", listener: (data: TestStderr) => void): this;
|
374
439
|
prependListener(event: "test:stdout", listener: (data: TestStdout) => void): this;
|
375
440
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
441
|
+
prependOnceListener(event: "test:coverage", listener: (data: TestCoverage) => void): this;
|
442
|
+
prependOnceListener(event: "test:complete", listener: (data: TestComplete) => void): this;
|
443
|
+
prependOnceListener(event: "test:dequeue", listener: (data: TestDequeue) => void): this;
|
376
444
|
prependOnceListener(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this;
|
445
|
+
prependOnceListener(event: "test:enqueue", listener: (data: TestEnqueue) => void): this;
|
377
446
|
prependOnceListener(event: "test:fail", listener: (data: TestFail) => void): this;
|
378
447
|
prependOnceListener(event: "test:pass", listener: (data: TestPass) => void): this;
|
379
448
|
prependOnceListener(event: "test:plan", listener: (data: TestPlan) => void): this;
|
@@ -578,7 +647,7 @@ declare module "node:test" {
|
|
578
647
|
todo?: boolean | string | undefined;
|
579
648
|
}
|
580
649
|
/**
|
581
|
-
* This function
|
650
|
+
* This function creates a hook that runs before executing a suite.
|
582
651
|
*
|
583
652
|
* ```js
|
584
653
|
* describe('tests', async () => {
|
@@ -594,7 +663,7 @@ declare module "node:test" {
|
|
594
663
|
*/
|
595
664
|
function before(fn?: HookFn, options?: HookOptions): void;
|
596
665
|
/**
|
597
|
-
* This function
|
666
|
+
* This function creates a hook that runs after executing a suite.
|
598
667
|
*
|
599
668
|
* ```js
|
600
669
|
* describe('tests', async () => {
|
@@ -610,8 +679,7 @@ declare module "node:test" {
|
|
610
679
|
*/
|
611
680
|
function after(fn?: HookFn, options?: HookOptions): void;
|
612
681
|
/**
|
613
|
-
* This function
|
614
|
-
* before each subtest of the current suite.
|
682
|
+
* This function creates a hook that runs before each test in the current suite.
|
615
683
|
*
|
616
684
|
* ```js
|
617
685
|
* describe('tests', async () => {
|
@@ -627,8 +695,8 @@ declare module "node:test" {
|
|
627
695
|
*/
|
628
696
|
function beforeEach(fn?: HookFn, options?: HookOptions): void;
|
629
697
|
/**
|
630
|
-
* This function
|
631
|
-
*
|
698
|
+
* This function creates a hook that runs after each test in the current suite.
|
699
|
+
* The `afterEach()` hook is run even if the test fails.
|
632
700
|
*
|
633
701
|
* ```js
|
634
702
|
* describe('tests', async () => {
|
@@ -1262,12 +1330,11 @@ interface TestLocationInfo {
|
|
1262
1330
|
*/
|
1263
1331
|
column?: number;
|
1264
1332
|
/**
|
1265
|
-
* The path of the test file, `undefined` if test
|
1333
|
+
* The path of the test file, `undefined` if test was run through the REPL.
|
1266
1334
|
*/
|
1267
1335
|
file?: string;
|
1268
1336
|
/**
|
1269
|
-
* The line number where the test is defined, or
|
1270
|
-
* `undefined` if the test was run through the REPL.
|
1337
|
+
* The line number where the test is defined, or `undefined` if the test was run through the REPL.
|
1271
1338
|
*/
|
1272
1339
|
line?: number;
|
1273
1340
|
}
|
@@ -1281,6 +1348,202 @@ interface DiagnosticData extends TestLocationInfo {
|
|
1281
1348
|
*/
|
1282
1349
|
nesting: number;
|
1283
1350
|
}
|
1351
|
+
interface TestCoverage {
|
1352
|
+
/**
|
1353
|
+
* An object containing the coverage report.
|
1354
|
+
*/
|
1355
|
+
summary: {
|
1356
|
+
/**
|
1357
|
+
* An array of coverage reports for individual files. Each report is an object with the following schema:
|
1358
|
+
*/
|
1359
|
+
files: Array<{
|
1360
|
+
/**
|
1361
|
+
* The absolute path of the file.
|
1362
|
+
*/
|
1363
|
+
path: string;
|
1364
|
+
/**
|
1365
|
+
* The total number of lines.
|
1366
|
+
*/
|
1367
|
+
totalLineCount: number;
|
1368
|
+
/**
|
1369
|
+
* The total number of branches.
|
1370
|
+
*/
|
1371
|
+
totalBranchCount: number;
|
1372
|
+
/**
|
1373
|
+
* The total number of functions.
|
1374
|
+
*/
|
1375
|
+
totalFunctionCount: number;
|
1376
|
+
/**
|
1377
|
+
* The number of covered lines.
|
1378
|
+
*/
|
1379
|
+
coveredLineCount: number;
|
1380
|
+
/**
|
1381
|
+
* The number of covered branches.
|
1382
|
+
*/
|
1383
|
+
coveredBranchCount: number;
|
1384
|
+
/**
|
1385
|
+
* The number of covered functions.
|
1386
|
+
*/
|
1387
|
+
coveredFunctionCount: number;
|
1388
|
+
/**
|
1389
|
+
* The percentage of lines covered.
|
1390
|
+
*/
|
1391
|
+
coveredLinePercent: number;
|
1392
|
+
/**
|
1393
|
+
* The percentage of branches covered.
|
1394
|
+
*/
|
1395
|
+
coveredBranchPercent: number;
|
1396
|
+
/**
|
1397
|
+
* The percentage of functions covered.
|
1398
|
+
*/
|
1399
|
+
coveredFunctionPercent: number;
|
1400
|
+
/**
|
1401
|
+
* An array of functions representing function coverage.
|
1402
|
+
*/
|
1403
|
+
functions: Array<{
|
1404
|
+
/**
|
1405
|
+
* The name of the function.
|
1406
|
+
*/
|
1407
|
+
name: string;
|
1408
|
+
/**
|
1409
|
+
* The line number where the function is defined.
|
1410
|
+
*/
|
1411
|
+
line: number;
|
1412
|
+
/**
|
1413
|
+
* The number of times the function was called.
|
1414
|
+
*/
|
1415
|
+
count: number;
|
1416
|
+
}>;
|
1417
|
+
/**
|
1418
|
+
* An array of lines representing line numbers and the number of times they were covered.
|
1419
|
+
*/
|
1420
|
+
lines: Array<{
|
1421
|
+
/**
|
1422
|
+
* The line number.
|
1423
|
+
*/
|
1424
|
+
line: number;
|
1425
|
+
/**
|
1426
|
+
* The number of times the line was covered.
|
1427
|
+
*/
|
1428
|
+
count: number;
|
1429
|
+
}>;
|
1430
|
+
}>;
|
1431
|
+
/**
|
1432
|
+
* An object containing a summary of coverage for all files.
|
1433
|
+
*/
|
1434
|
+
totals: {
|
1435
|
+
/**
|
1436
|
+
* The total number of lines.
|
1437
|
+
*/
|
1438
|
+
totalLineCount: number;
|
1439
|
+
/**
|
1440
|
+
* The total number of branches.
|
1441
|
+
*/
|
1442
|
+
totalBranchCount: number;
|
1443
|
+
/**
|
1444
|
+
* The total number of functions.
|
1445
|
+
*/
|
1446
|
+
totalFunctionCount: number;
|
1447
|
+
/**
|
1448
|
+
* The number of covered lines.
|
1449
|
+
*/
|
1450
|
+
coveredLineCount: number;
|
1451
|
+
/**
|
1452
|
+
* The number of covered branches.
|
1453
|
+
*/
|
1454
|
+
coveredBranchCount: number;
|
1455
|
+
/**
|
1456
|
+
* The number of covered functions.
|
1457
|
+
*/
|
1458
|
+
coveredFunctionCount: number;
|
1459
|
+
/**
|
1460
|
+
* The percentage of lines covered.
|
1461
|
+
*/
|
1462
|
+
coveredLinePercent: number;
|
1463
|
+
/**
|
1464
|
+
* The percentage of branches covered.
|
1465
|
+
*/
|
1466
|
+
coveredBranchPercent: number;
|
1467
|
+
/**
|
1468
|
+
* The percentage of functions covered.
|
1469
|
+
*/
|
1470
|
+
coveredFunctionPercent: number;
|
1471
|
+
};
|
1472
|
+
/**
|
1473
|
+
* The working directory when code coverage began. This
|
1474
|
+
* is useful for displaying relative path names in case
|
1475
|
+
* the tests changed the working directory of the Node.js process.
|
1476
|
+
*/
|
1477
|
+
workingDirectory: string;
|
1478
|
+
};
|
1479
|
+
/**
|
1480
|
+
* The nesting level of the test.
|
1481
|
+
*/
|
1482
|
+
nesting: number;
|
1483
|
+
}
|
1484
|
+
interface TestComplete extends TestLocationInfo {
|
1485
|
+
/**
|
1486
|
+
* Additional execution metadata.
|
1487
|
+
*/
|
1488
|
+
details: {
|
1489
|
+
/**
|
1490
|
+
* Whether the test passed or not.
|
1491
|
+
*/
|
1492
|
+
passed: boolean;
|
1493
|
+
/**
|
1494
|
+
* The duration of the test in milliseconds.
|
1495
|
+
*/
|
1496
|
+
duration_ms: number;
|
1497
|
+
/**
|
1498
|
+
* An error wrapping the error thrown by the test if it did not pass.
|
1499
|
+
*/
|
1500
|
+
error: Error;
|
1501
|
+
/**
|
1502
|
+
* The type of the test, used to denote whether this is a suite.
|
1503
|
+
*/
|
1504
|
+
type?: "suite";
|
1505
|
+
};
|
1506
|
+
/**
|
1507
|
+
* The test name.
|
1508
|
+
*/
|
1509
|
+
name: string;
|
1510
|
+
/**
|
1511
|
+
* The nesting level of the test.
|
1512
|
+
*/
|
1513
|
+
nesting: number;
|
1514
|
+
/**
|
1515
|
+
* The ordinal number of the test.
|
1516
|
+
*/
|
1517
|
+
testNumber: number;
|
1518
|
+
/**
|
1519
|
+
* Present if `context.todo` is called.
|
1520
|
+
*/
|
1521
|
+
todo?: string | boolean;
|
1522
|
+
/**
|
1523
|
+
* Present if `context.skip` is called.
|
1524
|
+
*/
|
1525
|
+
skip?: string | boolean;
|
1526
|
+
}
|
1527
|
+
interface TestDequeue extends TestLocationInfo {
|
1528
|
+
/**
|
1529
|
+
* The test name.
|
1530
|
+
*/
|
1531
|
+
name: string;
|
1532
|
+
/**
|
1533
|
+
* The nesting level of the test.
|
1534
|
+
*/
|
1535
|
+
nesting: number;
|
1536
|
+
}
|
1537
|
+
interface TestEnqueue extends TestLocationInfo {
|
1538
|
+
/**
|
1539
|
+
* The test name.
|
1540
|
+
*/
|
1541
|
+
name: string;
|
1542
|
+
/**
|
1543
|
+
* The nesting level of the test.
|
1544
|
+
*/
|
1545
|
+
nesting: number;
|
1546
|
+
}
|
1284
1547
|
interface TestFail extends TestLocationInfo {
|
1285
1548
|
/**
|
1286
1549
|
* Additional execution metadata.
|
@@ -1291,12 +1554,12 @@ interface TestFail extends TestLocationInfo {
|
|
1291
1554
|
*/
|
1292
1555
|
duration_ms: number;
|
1293
1556
|
/**
|
1294
|
-
*
|
1557
|
+
* An error wrapping the error thrown by the test if it did not pass.
|
1295
1558
|
*/
|
1296
1559
|
error: Error;
|
1297
1560
|
/**
|
1298
1561
|
* The type of the test, used to denote whether this is a suite.
|
1299
|
-
* @since
|
1562
|
+
* @since v20.0.0, v19.9.0, v18.17.0
|
1300
1563
|
*/
|
1301
1564
|
type?: "suite";
|
1302
1565
|
};
|
@@ -1379,36 +1642,16 @@ interface TestStart extends TestLocationInfo {
|
|
1379
1642
|
}
|
1380
1643
|
interface TestStderr extends TestLocationInfo {
|
1381
1644
|
/**
|
1382
|
-
* The message written to `stderr
|
1645
|
+
* The message written to `stderr`.
|
1383
1646
|
*/
|
1384
1647
|
message: string;
|
1385
1648
|
}
|
1386
1649
|
interface TestStdout extends TestLocationInfo {
|
1387
1650
|
/**
|
1388
|
-
* The message written to `stdout
|
1651
|
+
* The message written to `stdout`.
|
1389
1652
|
*/
|
1390
1653
|
message: string;
|
1391
1654
|
}
|
1392
|
-
interface TestEnqueue extends TestLocationInfo {
|
1393
|
-
/**
|
1394
|
-
* The test name
|
1395
|
-
*/
|
1396
|
-
name: string;
|
1397
|
-
/**
|
1398
|
-
* The nesting level of the test.
|
1399
|
-
*/
|
1400
|
-
nesting: number;
|
1401
|
-
}
|
1402
|
-
interface TestDequeue extends TestLocationInfo {
|
1403
|
-
/**
|
1404
|
-
* The test name
|
1405
|
-
*/
|
1406
|
-
name: string;
|
1407
|
-
/**
|
1408
|
-
* The nesting level of the test.
|
1409
|
-
*/
|
1410
|
-
nesting: number;
|
1411
|
-
}
|
1412
1655
|
|
1413
1656
|
/**
|
1414
1657
|
* The `node:test/reporters` module exposes the builtin-reporters for `node:test`.
|
@@ -1425,21 +1668,23 @@ interface TestDequeue extends TestLocationInfo {
|
|
1425
1668
|
* import test from 'test/reporters';
|
1426
1669
|
* ```
|
1427
1670
|
* @since v19.9.0
|
1428
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.
|
1671
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/test/reporters.js)
|
1429
1672
|
*/
|
1430
1673
|
declare module "node:test/reporters" {
|
1431
1674
|
import { Transform, TransformOptions } from "node:stream";
|
1432
1675
|
|
1433
1676
|
type TestEvent =
|
1677
|
+
| { type: "test:coverage"; data: TestCoverage }
|
1678
|
+
| { type: "test:complete"; data: TestComplete }
|
1679
|
+
| { type: "test:dequeue"; data: TestDequeue }
|
1434
1680
|
| { type: "test:diagnostic"; data: DiagnosticData }
|
1681
|
+
| { type: "test:enqueue"; data: TestEnqueue }
|
1435
1682
|
| { type: "test:fail"; data: TestFail }
|
1436
1683
|
| { type: "test:pass"; data: TestPass }
|
1437
1684
|
| { type: "test:plan"; data: TestPlan }
|
1438
1685
|
| { type: "test:start"; data: TestStart }
|
1439
1686
|
| { type: "test:stderr"; data: TestStderr }
|
1440
1687
|
| { type: "test:stdout"; data: TestStdout }
|
1441
|
-
| { type: "test:enqueue"; data: TestEnqueue }
|
1442
|
-
| { type: "test:dequeue"; data: TestDequeue }
|
1443
1688
|
| { type: "test:watch:drained" };
|
1444
1689
|
type TestEventGenerator = AsyncGenerator<TestEvent, void>;
|
1445
1690
|
|
@@ -1460,9 +1705,12 @@ declare module "node:test/reporters" {
|
|
1460
1705
|
constructor();
|
1461
1706
|
}
|
1462
1707
|
/**
|
1463
|
-
* The `junit` reporter outputs test results in a jUnit XML format
|
1708
|
+
* The `junit` reporter outputs test results in a jUnit XML format.
|
1464
1709
|
*/
|
1465
1710
|
function junit(source: TestEventGenerator): AsyncGenerator<string, void>;
|
1711
|
+
/**
|
1712
|
+
* The `lcov` reporter outputs test coverage when used with the [`--experimental-test-coverage`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--experimental-test-coverage) flag.
|
1713
|
+
*/
|
1466
1714
|
class Lcov extends Transform {
|
1467
1715
|
constructor(opts?: TransformOptions);
|
1468
1716
|
}
|
node/timers.d.ts
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
* The timer functions within Node.js implement a similar API as the timers API
|
7
7
|
* provided by Web Browsers but use a different internal implementation that is
|
8
8
|
* built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout).
|
9
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.
|
9
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/timers.js)
|
10
10
|
*/
|
11
11
|
declare module "timers" {
|
12
12
|
import { Abortable } from "node:events";
|
node/tls.d.ts
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
* ```js
|
7
7
|
* const tls = require('node:tls');
|
8
8
|
* ```
|
9
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.
|
9
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/tls.js)
|
10
10
|
*/
|
11
11
|
declare module "tls" {
|
12
12
|
import { X509Certificate } from "node:crypto";
|
node/trace_events.d.ts
CHANGED
@@ -90,7 +90,7 @@
|
|
90
90
|
*
|
91
91
|
* The features from this module are not available in [`Worker`](https://nodejs.org/docs/latest-v20.x/api/worker_threads.html#class-worker) threads.
|
92
92
|
* @experimental
|
93
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.
|
93
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/trace_events.js)
|
94
94
|
*/
|
95
95
|
declare module "trace_events" {
|
96
96
|
/**
|
node/tty.d.ts
CHANGED
@@ -21,7 +21,7 @@
|
|
21
21
|
*
|
22
22
|
* In most cases, there should be little to no reason for an application to
|
23
23
|
* manually create instances of the `tty.ReadStream` and `tty.WriteStream` classes.
|
24
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.
|
24
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/tty.js)
|
25
25
|
*/
|
26
26
|
declare module "tty" {
|
27
27
|
import * as net from "node:net";
|