@types/node 20.12.14 → 20.13.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 +1 -1
- node/child_process.d.ts +31 -29
- node/cluster.d.ts +1 -1
- node/console.d.ts +1 -1
- node/crypto.d.ts +2 -1
- node/dgram.d.ts +1 -1
- 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 +1 -1
- node/inspector.d.ts +1 -1
- node/net.d.ts +7 -4
- node/os.d.ts +1 -1
- node/package.json +2 -2
- node/path.d.ts +1 -1
- node/perf_hooks.d.ts +305 -45
- node/process.d.ts +11 -4
- node/punycode.d.ts +1 -1
- node/querystring.d.ts +1 -1
- node/readline.d.ts +1 -1
- node/repl.d.ts +1 -1
- node/stream.d.ts +15 -15
- node/string_decoder.d.ts +1 -1
- node/test.d.ts +291 -51
- 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/string_decoder.d.ts
CHANGED
@@ -36,7 +36,7 @@
|
|
36
36
|
* decoder.write(Buffer.from([0x82]));
|
37
37
|
* console.log(decoder.end(Buffer.from([0xAC]))); // Prints: €
|
38
38
|
* ```
|
39
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.
|
39
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/string_decoder.js)
|
40
40
|
*/
|
41
41
|
declare module "string_decoder" {
|
42
42
|
class StringDecoder {
|
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
|
@@ -330,10 +365,16 @@ declare module "node:test" {
|
|
330
365
|
/**
|
331
366
|
* 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
367
|
* order of the tests definition
|
368
|
+
*
|
369
|
+
* 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
370
|
* @since v18.9.0, v16.19.0
|
334
371
|
*/
|
335
372
|
class TestsStream extends Readable implements NodeJS.ReadableStream {
|
373
|
+
addListener(event: "test:coverage", listener: (data: TestCoverage) => void): this;
|
374
|
+
addListener(event: "test:complete", listener: (data: TestComplete) => void): this;
|
375
|
+
addListener(event: "test:dequeue", listener: (data: TestDequeue) => void): this;
|
336
376
|
addListener(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this;
|
377
|
+
addListener(event: "test:enqueue", listener: (data: TestEnqueue) => void): this;
|
337
378
|
addListener(event: "test:fail", listener: (data: TestFail) => void): this;
|
338
379
|
addListener(event: "test:pass", listener: (data: TestPass) => void): this;
|
339
380
|
addListener(event: "test:plan", listener: (data: TestPlan) => void): this;
|
@@ -341,7 +382,11 @@ declare module "node:test" {
|
|
341
382
|
addListener(event: "test:stderr", listener: (data: TestStderr) => void): this;
|
342
383
|
addListener(event: "test:stdout", listener: (data: TestStdout) => void): this;
|
343
384
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
385
|
+
emit(event: "test:coverage", data: TestCoverage): boolean;
|
386
|
+
emit(event: "test:complete", data: TestComplete): boolean;
|
387
|
+
emit(event: "test:dequeue", data: TestDequeue): boolean;
|
344
388
|
emit(event: "test:diagnostic", data: DiagnosticData): boolean;
|
389
|
+
emit(event: "test:enqueue", data: TestEnqueue): boolean;
|
345
390
|
emit(event: "test:fail", data: TestFail): boolean;
|
346
391
|
emit(event: "test:pass", data: TestPass): boolean;
|
347
392
|
emit(event: "test:plan", data: TestPlan): boolean;
|
@@ -349,7 +394,11 @@ declare module "node:test" {
|
|
349
394
|
emit(event: "test:stderr", data: TestStderr): boolean;
|
350
395
|
emit(event: "test:stdout", data: TestStdout): boolean;
|
351
396
|
emit(event: string | symbol, ...args: any[]): boolean;
|
397
|
+
on(event: "test:coverage", listener: (data: TestCoverage) => void): this;
|
398
|
+
on(event: "test:complete", listener: (data: TestComplete) => void): this;
|
399
|
+
on(event: "test:dequeue", listener: (data: TestDequeue) => void): this;
|
352
400
|
on(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this;
|
401
|
+
on(event: "test:enqueue", listener: (data: TestEnqueue) => void): this;
|
353
402
|
on(event: "test:fail", listener: (data: TestFail) => void): this;
|
354
403
|
on(event: "test:pass", listener: (data: TestPass) => void): this;
|
355
404
|
on(event: "test:plan", listener: (data: TestPlan) => void): this;
|
@@ -357,7 +406,11 @@ declare module "node:test" {
|
|
357
406
|
on(event: "test:stderr", listener: (data: TestStderr) => void): this;
|
358
407
|
on(event: "test:stdout", listener: (data: TestStdout) => void): this;
|
359
408
|
on(event: string, listener: (...args: any[]) => void): this;
|
409
|
+
once(event: "test:coverage", listener: (data: TestCoverage) => void): this;
|
410
|
+
once(event: "test:complete", listener: (data: TestComplete) => void): this;
|
411
|
+
once(event: "test:dequeue", listener: (data: TestDequeue) => void): this;
|
360
412
|
once(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this;
|
413
|
+
once(event: "test:enqueue", listener: (data: TestEnqueue) => void): this;
|
361
414
|
once(event: "test:fail", listener: (data: TestFail) => void): this;
|
362
415
|
once(event: "test:pass", listener: (data: TestPass) => void): this;
|
363
416
|
once(event: "test:plan", listener: (data: TestPlan) => void): this;
|
@@ -365,7 +418,11 @@ declare module "node:test" {
|
|
365
418
|
once(event: "test:stderr", listener: (data: TestStderr) => void): this;
|
366
419
|
once(event: "test:stdout", listener: (data: TestStdout) => void): this;
|
367
420
|
once(event: string, listener: (...args: any[]) => void): this;
|
421
|
+
prependListener(event: "test:coverage", listener: (data: TestCoverage) => void): this;
|
422
|
+
prependListener(event: "test:complete", listener: (data: TestComplete) => void): this;
|
423
|
+
prependListener(event: "test:dequeue", listener: (data: TestDequeue) => void): this;
|
368
424
|
prependListener(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this;
|
425
|
+
prependListener(event: "test:enqueue", listener: (data: TestEnqueue) => void): this;
|
369
426
|
prependListener(event: "test:fail", listener: (data: TestFail) => void): this;
|
370
427
|
prependListener(event: "test:pass", listener: (data: TestPass) => void): this;
|
371
428
|
prependListener(event: "test:plan", listener: (data: TestPlan) => void): this;
|
@@ -373,7 +430,11 @@ declare module "node:test" {
|
|
373
430
|
prependListener(event: "test:stderr", listener: (data: TestStderr) => void): this;
|
374
431
|
prependListener(event: "test:stdout", listener: (data: TestStdout) => void): this;
|
375
432
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
433
|
+
prependOnceListener(event: "test:coverage", listener: (data: TestCoverage) => void): this;
|
434
|
+
prependOnceListener(event: "test:complete", listener: (data: TestComplete) => void): this;
|
435
|
+
prependOnceListener(event: "test:dequeue", listener: (data: TestDequeue) => void): this;
|
376
436
|
prependOnceListener(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this;
|
437
|
+
prependOnceListener(event: "test:enqueue", listener: (data: TestEnqueue) => void): this;
|
377
438
|
prependOnceListener(event: "test:fail", listener: (data: TestFail) => void): this;
|
378
439
|
prependOnceListener(event: "test:pass", listener: (data: TestPass) => void): this;
|
379
440
|
prependOnceListener(event: "test:plan", listener: (data: TestPlan) => void): this;
|
@@ -578,7 +639,7 @@ declare module "node:test" {
|
|
578
639
|
todo?: boolean | string | undefined;
|
579
640
|
}
|
580
641
|
/**
|
581
|
-
* This function
|
642
|
+
* This function creates a hook that runs before executing a suite.
|
582
643
|
*
|
583
644
|
* ```js
|
584
645
|
* describe('tests', async () => {
|
@@ -594,7 +655,7 @@ declare module "node:test" {
|
|
594
655
|
*/
|
595
656
|
function before(fn?: HookFn, options?: HookOptions): void;
|
596
657
|
/**
|
597
|
-
* This function
|
658
|
+
* This function creates a hook that runs after executing a suite.
|
598
659
|
*
|
599
660
|
* ```js
|
600
661
|
* describe('tests', async () => {
|
@@ -610,8 +671,7 @@ declare module "node:test" {
|
|
610
671
|
*/
|
611
672
|
function after(fn?: HookFn, options?: HookOptions): void;
|
612
673
|
/**
|
613
|
-
* This function
|
614
|
-
* before each subtest of the current suite.
|
674
|
+
* This function creates a hook that runs before each test in the current suite.
|
615
675
|
*
|
616
676
|
* ```js
|
617
677
|
* describe('tests', async () => {
|
@@ -627,8 +687,8 @@ declare module "node:test" {
|
|
627
687
|
*/
|
628
688
|
function beforeEach(fn?: HookFn, options?: HookOptions): void;
|
629
689
|
/**
|
630
|
-
* This function
|
631
|
-
*
|
690
|
+
* This function creates a hook that runs after each test in the current suite.
|
691
|
+
* The `afterEach()` hook is run even if the test fails.
|
632
692
|
*
|
633
693
|
* ```js
|
634
694
|
* describe('tests', async () => {
|
@@ -1262,12 +1322,11 @@ interface TestLocationInfo {
|
|
1262
1322
|
*/
|
1263
1323
|
column?: number;
|
1264
1324
|
/**
|
1265
|
-
* The path of the test file, `undefined` if test
|
1325
|
+
* The path of the test file, `undefined` if test was run through the REPL.
|
1266
1326
|
*/
|
1267
1327
|
file?: string;
|
1268
1328
|
/**
|
1269
|
-
* The line number where the test is defined, or
|
1270
|
-
* `undefined` if the test was run through the REPL.
|
1329
|
+
* The line number where the test is defined, or `undefined` if the test was run through the REPL.
|
1271
1330
|
*/
|
1272
1331
|
line?: number;
|
1273
1332
|
}
|
@@ -1281,6 +1340,202 @@ interface DiagnosticData extends TestLocationInfo {
|
|
1281
1340
|
*/
|
1282
1341
|
nesting: number;
|
1283
1342
|
}
|
1343
|
+
interface TestCoverage {
|
1344
|
+
/**
|
1345
|
+
* An object containing the coverage report.
|
1346
|
+
*/
|
1347
|
+
summary: {
|
1348
|
+
/**
|
1349
|
+
* An array of coverage reports for individual files. Each report is an object with the following schema:
|
1350
|
+
*/
|
1351
|
+
files: Array<{
|
1352
|
+
/**
|
1353
|
+
* The absolute path of the file.
|
1354
|
+
*/
|
1355
|
+
path: string;
|
1356
|
+
/**
|
1357
|
+
* The total number of lines.
|
1358
|
+
*/
|
1359
|
+
totalLineCount: number;
|
1360
|
+
/**
|
1361
|
+
* The total number of branches.
|
1362
|
+
*/
|
1363
|
+
totalBranchCount: number;
|
1364
|
+
/**
|
1365
|
+
* The total number of functions.
|
1366
|
+
*/
|
1367
|
+
totalFunctionCount: number;
|
1368
|
+
/**
|
1369
|
+
* The number of covered lines.
|
1370
|
+
*/
|
1371
|
+
coveredLineCount: number;
|
1372
|
+
/**
|
1373
|
+
* The number of covered branches.
|
1374
|
+
*/
|
1375
|
+
coveredBranchCount: number;
|
1376
|
+
/**
|
1377
|
+
* The number of covered functions.
|
1378
|
+
*/
|
1379
|
+
coveredFunctionCount: number;
|
1380
|
+
/**
|
1381
|
+
* The percentage of lines covered.
|
1382
|
+
*/
|
1383
|
+
coveredLinePercent: number;
|
1384
|
+
/**
|
1385
|
+
* The percentage of branches covered.
|
1386
|
+
*/
|
1387
|
+
coveredBranchPercent: number;
|
1388
|
+
/**
|
1389
|
+
* The percentage of functions covered.
|
1390
|
+
*/
|
1391
|
+
coveredFunctionPercent: number;
|
1392
|
+
/**
|
1393
|
+
* An array of functions representing function coverage.
|
1394
|
+
*/
|
1395
|
+
functions: Array<{
|
1396
|
+
/**
|
1397
|
+
* The name of the function.
|
1398
|
+
*/
|
1399
|
+
name: string;
|
1400
|
+
/**
|
1401
|
+
* The line number where the function is defined.
|
1402
|
+
*/
|
1403
|
+
line: number;
|
1404
|
+
/**
|
1405
|
+
* The number of times the function was called.
|
1406
|
+
*/
|
1407
|
+
count: number;
|
1408
|
+
}>;
|
1409
|
+
/**
|
1410
|
+
* An array of lines representing line numbers and the number of times they were covered.
|
1411
|
+
*/
|
1412
|
+
lines: Array<{
|
1413
|
+
/**
|
1414
|
+
* The line number.
|
1415
|
+
*/
|
1416
|
+
line: number;
|
1417
|
+
/**
|
1418
|
+
* The number of times the line was covered.
|
1419
|
+
*/
|
1420
|
+
count: number;
|
1421
|
+
}>;
|
1422
|
+
}>;
|
1423
|
+
/**
|
1424
|
+
* An object containing a summary of coverage for all files.
|
1425
|
+
*/
|
1426
|
+
totals: {
|
1427
|
+
/**
|
1428
|
+
* The total number of lines.
|
1429
|
+
*/
|
1430
|
+
totalLineCount: number;
|
1431
|
+
/**
|
1432
|
+
* The total number of branches.
|
1433
|
+
*/
|
1434
|
+
totalBranchCount: number;
|
1435
|
+
/**
|
1436
|
+
* The total number of functions.
|
1437
|
+
*/
|
1438
|
+
totalFunctionCount: number;
|
1439
|
+
/**
|
1440
|
+
* The number of covered lines.
|
1441
|
+
*/
|
1442
|
+
coveredLineCount: number;
|
1443
|
+
/**
|
1444
|
+
* The number of covered branches.
|
1445
|
+
*/
|
1446
|
+
coveredBranchCount: number;
|
1447
|
+
/**
|
1448
|
+
* The number of covered functions.
|
1449
|
+
*/
|
1450
|
+
coveredFunctionCount: number;
|
1451
|
+
/**
|
1452
|
+
* The percentage of lines covered.
|
1453
|
+
*/
|
1454
|
+
coveredLinePercent: number;
|
1455
|
+
/**
|
1456
|
+
* The percentage of branches covered.
|
1457
|
+
*/
|
1458
|
+
coveredBranchPercent: number;
|
1459
|
+
/**
|
1460
|
+
* The percentage of functions covered.
|
1461
|
+
*/
|
1462
|
+
coveredFunctionPercent: number;
|
1463
|
+
};
|
1464
|
+
/**
|
1465
|
+
* The working directory when code coverage began. This
|
1466
|
+
* is useful for displaying relative path names in case
|
1467
|
+
* the tests changed the working directory of the Node.js process.
|
1468
|
+
*/
|
1469
|
+
workingDirectory: string;
|
1470
|
+
};
|
1471
|
+
/**
|
1472
|
+
* The nesting level of the test.
|
1473
|
+
*/
|
1474
|
+
nesting: number;
|
1475
|
+
}
|
1476
|
+
interface TestComplete extends TestLocationInfo {
|
1477
|
+
/**
|
1478
|
+
* Additional execution metadata.
|
1479
|
+
*/
|
1480
|
+
details: {
|
1481
|
+
/**
|
1482
|
+
* Whether the test passed or not.
|
1483
|
+
*/
|
1484
|
+
passed: boolean;
|
1485
|
+
/**
|
1486
|
+
* The duration of the test in milliseconds.
|
1487
|
+
*/
|
1488
|
+
duration_ms: number;
|
1489
|
+
/**
|
1490
|
+
* An error wrapping the error thrown by the test if it did not pass.
|
1491
|
+
*/
|
1492
|
+
error: Error;
|
1493
|
+
/**
|
1494
|
+
* The type of the test, used to denote whether this is a suite.
|
1495
|
+
*/
|
1496
|
+
type?: "suite";
|
1497
|
+
};
|
1498
|
+
/**
|
1499
|
+
* The test name.
|
1500
|
+
*/
|
1501
|
+
name: string;
|
1502
|
+
/**
|
1503
|
+
* The nesting level of the test.
|
1504
|
+
*/
|
1505
|
+
nesting: number;
|
1506
|
+
/**
|
1507
|
+
* The ordinal number of the test.
|
1508
|
+
*/
|
1509
|
+
testNumber: number;
|
1510
|
+
/**
|
1511
|
+
* Present if `context.todo` is called.
|
1512
|
+
*/
|
1513
|
+
todo?: string | boolean;
|
1514
|
+
/**
|
1515
|
+
* Present if `context.skip` is called.
|
1516
|
+
*/
|
1517
|
+
skip?: string | boolean;
|
1518
|
+
}
|
1519
|
+
interface TestDequeue extends TestLocationInfo {
|
1520
|
+
/**
|
1521
|
+
* The test name.
|
1522
|
+
*/
|
1523
|
+
name: string;
|
1524
|
+
/**
|
1525
|
+
* The nesting level of the test.
|
1526
|
+
*/
|
1527
|
+
nesting: number;
|
1528
|
+
}
|
1529
|
+
interface TestEnqueue extends TestLocationInfo {
|
1530
|
+
/**
|
1531
|
+
* The test name.
|
1532
|
+
*/
|
1533
|
+
name: string;
|
1534
|
+
/**
|
1535
|
+
* The nesting level of the test.
|
1536
|
+
*/
|
1537
|
+
nesting: number;
|
1538
|
+
}
|
1284
1539
|
interface TestFail extends TestLocationInfo {
|
1285
1540
|
/**
|
1286
1541
|
* Additional execution metadata.
|
@@ -1291,12 +1546,12 @@ interface TestFail extends TestLocationInfo {
|
|
1291
1546
|
*/
|
1292
1547
|
duration_ms: number;
|
1293
1548
|
/**
|
1294
|
-
*
|
1549
|
+
* An error wrapping the error thrown by the test if it did not pass.
|
1295
1550
|
*/
|
1296
1551
|
error: Error;
|
1297
1552
|
/**
|
1298
1553
|
* The type of the test, used to denote whether this is a suite.
|
1299
|
-
* @since
|
1554
|
+
* @since v20.0.0, v19.9.0, v18.17.0
|
1300
1555
|
*/
|
1301
1556
|
type?: "suite";
|
1302
1557
|
};
|
@@ -1379,36 +1634,16 @@ interface TestStart extends TestLocationInfo {
|
|
1379
1634
|
}
|
1380
1635
|
interface TestStderr extends TestLocationInfo {
|
1381
1636
|
/**
|
1382
|
-
* The message written to `stderr
|
1637
|
+
* The message written to `stderr`.
|
1383
1638
|
*/
|
1384
1639
|
message: string;
|
1385
1640
|
}
|
1386
1641
|
interface TestStdout extends TestLocationInfo {
|
1387
1642
|
/**
|
1388
|
-
* The message written to `stdout
|
1643
|
+
* The message written to `stdout`.
|
1389
1644
|
*/
|
1390
1645
|
message: string;
|
1391
1646
|
}
|
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
1647
|
|
1413
1648
|
/**
|
1414
1649
|
* The `node:test/reporters` module exposes the builtin-reporters for `node:test`.
|
@@ -1425,21 +1660,23 @@ interface TestDequeue extends TestLocationInfo {
|
|
1425
1660
|
* import test from 'test/reporters';
|
1426
1661
|
* ```
|
1427
1662
|
* @since v19.9.0
|
1428
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.
|
1663
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/test/reporters.js)
|
1429
1664
|
*/
|
1430
1665
|
declare module "node:test/reporters" {
|
1431
1666
|
import { Transform, TransformOptions } from "node:stream";
|
1432
1667
|
|
1433
1668
|
type TestEvent =
|
1669
|
+
| { type: "test:coverage"; data: TestCoverage }
|
1670
|
+
| { type: "test:complete"; data: TestComplete }
|
1671
|
+
| { type: "test:dequeue"; data: TestDequeue }
|
1434
1672
|
| { type: "test:diagnostic"; data: DiagnosticData }
|
1673
|
+
| { type: "test:enqueue"; data: TestEnqueue }
|
1435
1674
|
| { type: "test:fail"; data: TestFail }
|
1436
1675
|
| { type: "test:pass"; data: TestPass }
|
1437
1676
|
| { type: "test:plan"; data: TestPlan }
|
1438
1677
|
| { type: "test:start"; data: TestStart }
|
1439
1678
|
| { type: "test:stderr"; data: TestStderr }
|
1440
1679
|
| { type: "test:stdout"; data: TestStdout }
|
1441
|
-
| { type: "test:enqueue"; data: TestEnqueue }
|
1442
|
-
| { type: "test:dequeue"; data: TestDequeue }
|
1443
1680
|
| { type: "test:watch:drained" };
|
1444
1681
|
type TestEventGenerator = AsyncGenerator<TestEvent, void>;
|
1445
1682
|
|
@@ -1460,9 +1697,12 @@ declare module "node:test/reporters" {
|
|
1460
1697
|
constructor();
|
1461
1698
|
}
|
1462
1699
|
/**
|
1463
|
-
* The `junit` reporter outputs test results in a jUnit XML format
|
1700
|
+
* The `junit` reporter outputs test results in a jUnit XML format.
|
1464
1701
|
*/
|
1465
1702
|
function junit(source: TestEventGenerator): AsyncGenerator<string, void>;
|
1703
|
+
/**
|
1704
|
+
* 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.
|
1705
|
+
*/
|
1466
1706
|
class Lcov extends Transform {
|
1467
1707
|
constructor(opts?: TransformOptions);
|
1468
1708
|
}
|
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";
|
node/url.d.ts
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
* ```js
|
6
6
|
* import url from 'node:url';
|
7
7
|
* ```
|
8
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.
|
8
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/url.js)
|
9
9
|
*/
|
10
10
|
declare module "url" {
|
11
11
|
import { Blob as NodeBlob } from "node:buffer";
|
@@ -46,6 +46,14 @@ declare module "url" {
|
|
46
46
|
interface UrlWithStringQuery extends Url {
|
47
47
|
query: string | null;
|
48
48
|
}
|
49
|
+
interface FileUrlToPathOptions {
|
50
|
+
/**
|
51
|
+
* `true` if the `path` should be return as a windows filepath, `false` for posix, and `undefined` for the system default.
|
52
|
+
* @default undefined
|
53
|
+
*/
|
54
|
+
windows?: boolean | undefined;
|
55
|
+
}
|
56
|
+
interface PathToFileUrlOptions extends FileUrlToPathOptions {}
|
49
57
|
/**
|
50
58
|
* The `url.parse()` method takes a URL string, parses it, and returns a URL
|
51
59
|
* object.
|
@@ -298,7 +306,7 @@ declare module "url" {
|
|
298
306
|
* @param url The file URL string or URL object to convert to a path.
|
299
307
|
* @return The fully-resolved platform-specific Node.js file path.
|
300
308
|
*/
|
301
|
-
function fileURLToPath(url: string | URL): string;
|
309
|
+
function fileURLToPath(url: string | URL, options?: FileUrlToPathOptions): string;
|
302
310
|
/**
|
303
311
|
* This function ensures that `path` is resolved absolutely, and that the URL
|
304
312
|
* control characters are correctly encoded when converting into a File URL.
|
@@ -316,7 +324,7 @@ declare module "url" {
|
|
316
324
|
* @param path The path to convert to a File URL.
|
317
325
|
* @return The file URL object.
|
318
326
|
*/
|
319
|
-
function pathToFileURL(path: string): URL;
|
327
|
+
function pathToFileURL(path: string, options?: PathToFileUrlOptions): URL;
|
320
328
|
/**
|
321
329
|
* This utility function converts a URL object into an ordinary options object as
|
322
330
|
* expected by the `http.request()` and `https.request()` APIs.
|