@types/node 20.3.0 → 20.3.2
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/cluster.d.ts +2 -0
- node/package.json +2 -2
- node/test.d.ts +198 -96
- node/ts4.8/cluster.d.ts +2 -0
- node/ts4.8/test.d.ts +198 -96
node/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (https://nodejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Mon, 26 Jun 2023 20:02:42 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
|
|
14
14
|
|
node/cluster.d.ts
CHANGED
|
@@ -67,6 +67,8 @@ declare module 'cluster' {
|
|
|
67
67
|
gid?: number | undefined;
|
|
68
68
|
inspectPort?: number | (() => number) | undefined;
|
|
69
69
|
serialization?: SerializationType | undefined;
|
|
70
|
+
cwd?: string | undefined;
|
|
71
|
+
windowsHide?: boolean | undefined;
|
|
70
72
|
}
|
|
71
73
|
export interface Address {
|
|
72
74
|
address: string;
|
node/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "20.3.
|
|
3
|
+
"version": "20.3.2",
|
|
4
4
|
"description": "TypeScript definitions for Node.js",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -232,6 +232,6 @@
|
|
|
232
232
|
},
|
|
233
233
|
"scripts": {},
|
|
234
234
|
"dependencies": {},
|
|
235
|
-
"typesPublisherContentHash": "
|
|
235
|
+
"typesPublisherContentHash": "77b1f16021a42a5f28f9061a3922380bdc6bcd9630c2405d53ff935c6538793c",
|
|
236
236
|
"typeScriptVersion": "4.3"
|
|
237
237
|
}
|
node/test.d.ts
CHANGED
|
@@ -307,134 +307,50 @@ declare module 'node:test' {
|
|
|
307
307
|
addListener(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
308
308
|
addListener(event: 'test:plan', listener: (data: TestPlan) => void): this;
|
|
309
309
|
addListener(event: 'test:start', listener: (data: TestStart) => void): this;
|
|
310
|
+
addListener(event: 'test:stderr', listener: (data: TestStderr) => void): this;
|
|
311
|
+
addListener(event: 'test:stdout', listener: (data: TestStdout) => void): this;
|
|
310
312
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
311
313
|
emit(event: 'test:diagnostic', data: DiagnosticData): boolean;
|
|
312
314
|
emit(event: 'test:fail', data: TestFail): boolean;
|
|
313
315
|
emit(event: 'test:pass', data: TestPass): boolean;
|
|
314
316
|
emit(event: 'test:plan', data: TestPlan): boolean;
|
|
315
317
|
emit(event: 'test:start', data: TestStart): boolean;
|
|
318
|
+
emit(event: 'test:stderr', data: TestStderr): boolean;
|
|
319
|
+
emit(event: 'test:stdout', data: TestStdout): boolean;
|
|
316
320
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
317
321
|
on(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this;
|
|
318
322
|
on(event: 'test:fail', listener: (data: TestFail) => void): this;
|
|
319
323
|
on(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
320
324
|
on(event: 'test:plan', listener: (data: TestPlan) => void): this;
|
|
321
325
|
on(event: 'test:start', listener: (data: TestStart) => void): this;
|
|
326
|
+
on(event: 'test:stderr', listener: (data: TestStderr) => void): this;
|
|
327
|
+
on(event: 'test:stdout', listener: (data: TestStdout) => void): this;
|
|
322
328
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
323
329
|
once(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this;
|
|
324
330
|
once(event: 'test:fail', listener: (data: TestFail) => void): this;
|
|
325
331
|
once(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
326
332
|
once(event: 'test:plan', listener: (data: TestPlan) => void): this;
|
|
327
333
|
once(event: 'test:start', listener: (data: TestStart) => void): this;
|
|
334
|
+
once(event: 'test:stderr', listener: (data: TestStderr) => void): this;
|
|
335
|
+
once(event: 'test:stdout', listener: (data: TestStdout) => void): this;
|
|
328
336
|
once(event: string, listener: (...args: any[]) => void): this;
|
|
329
337
|
prependListener(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this;
|
|
330
338
|
prependListener(event: 'test:fail', listener: (data: TestFail) => void): this;
|
|
331
339
|
prependListener(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
332
340
|
prependListener(event: 'test:plan', listener: (data: TestPlan) => void): this;
|
|
333
341
|
prependListener(event: 'test:start', listener: (data: TestStart) => void): this;
|
|
342
|
+
prependListener(event: 'test:stderr', listener: (data: TestStderr) => void): this;
|
|
343
|
+
prependListener(event: 'test:stdout', listener: (data: TestStdout) => void): this;
|
|
334
344
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
335
345
|
prependOnceListener(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this;
|
|
336
346
|
prependOnceListener(event: 'test:fail', listener: (data: TestFail) => void): this;
|
|
337
347
|
prependOnceListener(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
338
348
|
prependOnceListener(event: 'test:plan', listener: (data: TestPlan) => void): this;
|
|
339
349
|
prependOnceListener(event: 'test:start', listener: (data: TestStart) => void): this;
|
|
350
|
+
prependOnceListener(event: 'test:stderr', listener: (data: TestStderr) => void): this;
|
|
351
|
+
prependOnceListener(event: 'test:stdout', listener: (data: TestStdout) => void): this;
|
|
340
352
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
341
353
|
}
|
|
342
|
-
interface DiagnosticData {
|
|
343
|
-
/**
|
|
344
|
-
* The diagnostic message.
|
|
345
|
-
*/
|
|
346
|
-
message: string;
|
|
347
|
-
/**
|
|
348
|
-
* The nesting level of the test.
|
|
349
|
-
*/
|
|
350
|
-
nesting: number;
|
|
351
|
-
}
|
|
352
|
-
interface TestFail {
|
|
353
|
-
/**
|
|
354
|
-
* Additional execution metadata.
|
|
355
|
-
*/
|
|
356
|
-
details: {
|
|
357
|
-
/**
|
|
358
|
-
* The duration of the test in milliseconds.
|
|
359
|
-
*/
|
|
360
|
-
duration: number;
|
|
361
|
-
/**
|
|
362
|
-
* The error thrown by the test.
|
|
363
|
-
*/
|
|
364
|
-
error: Error;
|
|
365
|
-
};
|
|
366
|
-
/**
|
|
367
|
-
* The test name.
|
|
368
|
-
*/
|
|
369
|
-
name: string;
|
|
370
|
-
/**
|
|
371
|
-
* The nesting level of the test.
|
|
372
|
-
*/
|
|
373
|
-
nesting: number;
|
|
374
|
-
/**
|
|
375
|
-
* The ordinal number of the test.
|
|
376
|
-
*/
|
|
377
|
-
testNumber: number;
|
|
378
|
-
/**
|
|
379
|
-
* Present if `context.todo` is called.
|
|
380
|
-
*/
|
|
381
|
-
todo?: string | boolean;
|
|
382
|
-
/**
|
|
383
|
-
* Present if `context.skip` is called.
|
|
384
|
-
*/
|
|
385
|
-
skip?: string | boolean;
|
|
386
|
-
}
|
|
387
|
-
interface TestPass {
|
|
388
|
-
/**
|
|
389
|
-
* Additional execution metadata.
|
|
390
|
-
*/
|
|
391
|
-
details: {
|
|
392
|
-
/**
|
|
393
|
-
* The duration of the test in milliseconds.
|
|
394
|
-
*/
|
|
395
|
-
duration: number;
|
|
396
|
-
};
|
|
397
|
-
/**
|
|
398
|
-
* The test name.
|
|
399
|
-
*/
|
|
400
|
-
name: string;
|
|
401
|
-
/**
|
|
402
|
-
* The nesting level of the test.
|
|
403
|
-
*/
|
|
404
|
-
nesting: number;
|
|
405
|
-
/**
|
|
406
|
-
* The ordinal number of the test.
|
|
407
|
-
*/
|
|
408
|
-
testNumber: number;
|
|
409
|
-
/**
|
|
410
|
-
* Present if `context.todo` is called.
|
|
411
|
-
*/
|
|
412
|
-
todo?: string | boolean;
|
|
413
|
-
/**
|
|
414
|
-
* Present if `context.skip` is called.
|
|
415
|
-
*/
|
|
416
|
-
skip?: string | boolean;
|
|
417
|
-
}
|
|
418
|
-
interface TestPlan {
|
|
419
|
-
/**
|
|
420
|
-
* The nesting level of the test.
|
|
421
|
-
*/
|
|
422
|
-
nesting: number;
|
|
423
|
-
/**
|
|
424
|
-
* The number of subtests that have ran.
|
|
425
|
-
*/
|
|
426
|
-
count: number;
|
|
427
|
-
}
|
|
428
|
-
interface TestStart {
|
|
429
|
-
/**
|
|
430
|
-
* The test name.
|
|
431
|
-
*/
|
|
432
|
-
name: string;
|
|
433
|
-
/**
|
|
434
|
-
* The nesting level of the test.
|
|
435
|
-
*/
|
|
436
|
-
nesting: number;
|
|
437
|
-
}
|
|
438
354
|
/**
|
|
439
355
|
* An instance of `TestContext` is passed to each test function in order to
|
|
440
356
|
* interact with the test runner. However, the `TestContext` constructor is not
|
|
@@ -1050,3 +966,189 @@ declare module 'node:test' {
|
|
|
1050
966
|
}
|
|
1051
967
|
export { test as default, run, test, describe, it, before, after, beforeEach, afterEach, mock, skip, only, todo };
|
|
1052
968
|
}
|
|
969
|
+
|
|
970
|
+
interface DiagnosticData {
|
|
971
|
+
/**
|
|
972
|
+
* The diagnostic message.
|
|
973
|
+
*/
|
|
974
|
+
message: string;
|
|
975
|
+
/**
|
|
976
|
+
* The nesting level of the test.
|
|
977
|
+
*/
|
|
978
|
+
nesting: number;
|
|
979
|
+
/**
|
|
980
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
981
|
+
*/
|
|
982
|
+
file?: string;
|
|
983
|
+
}
|
|
984
|
+
interface TestFail {
|
|
985
|
+
/**
|
|
986
|
+
* Additional execution metadata.
|
|
987
|
+
*/
|
|
988
|
+
details: {
|
|
989
|
+
/**
|
|
990
|
+
* The duration of the test in milliseconds.
|
|
991
|
+
*/
|
|
992
|
+
duration: number;
|
|
993
|
+
/**
|
|
994
|
+
* The error thrown by the test.
|
|
995
|
+
*/
|
|
996
|
+
error: Error;
|
|
997
|
+
};
|
|
998
|
+
/**
|
|
999
|
+
* The test name.
|
|
1000
|
+
*/
|
|
1001
|
+
name: string;
|
|
1002
|
+
/**
|
|
1003
|
+
* The nesting level of the test.
|
|
1004
|
+
*/
|
|
1005
|
+
nesting: number;
|
|
1006
|
+
/**
|
|
1007
|
+
* The ordinal number of the test.
|
|
1008
|
+
*/
|
|
1009
|
+
testNumber: number;
|
|
1010
|
+
/**
|
|
1011
|
+
* Present if `context.todo` is called.
|
|
1012
|
+
*/
|
|
1013
|
+
todo?: string | boolean;
|
|
1014
|
+
/**
|
|
1015
|
+
* Present if `context.skip` is called.
|
|
1016
|
+
*/
|
|
1017
|
+
skip?: string | boolean;
|
|
1018
|
+
/**
|
|
1019
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
1020
|
+
*/
|
|
1021
|
+
file?: string;
|
|
1022
|
+
}
|
|
1023
|
+
interface TestPass {
|
|
1024
|
+
/**
|
|
1025
|
+
* Additional execution metadata.
|
|
1026
|
+
*/
|
|
1027
|
+
details: {
|
|
1028
|
+
/**
|
|
1029
|
+
* The duration of the test in milliseconds.
|
|
1030
|
+
*/
|
|
1031
|
+
duration: number;
|
|
1032
|
+
};
|
|
1033
|
+
/**
|
|
1034
|
+
* The test name.
|
|
1035
|
+
*/
|
|
1036
|
+
name: string;
|
|
1037
|
+
/**
|
|
1038
|
+
* The nesting level of the test.
|
|
1039
|
+
*/
|
|
1040
|
+
nesting: number;
|
|
1041
|
+
/**
|
|
1042
|
+
* The ordinal number of the test.
|
|
1043
|
+
*/
|
|
1044
|
+
testNumber: number;
|
|
1045
|
+
/**
|
|
1046
|
+
* Present if `context.todo` is called.
|
|
1047
|
+
*/
|
|
1048
|
+
todo?: string | boolean;
|
|
1049
|
+
/**
|
|
1050
|
+
* Present if `context.skip` is called.
|
|
1051
|
+
*/
|
|
1052
|
+
skip?: string | boolean;
|
|
1053
|
+
/**
|
|
1054
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
1055
|
+
*/
|
|
1056
|
+
file?: string;
|
|
1057
|
+
}
|
|
1058
|
+
interface TestPlan {
|
|
1059
|
+
/**
|
|
1060
|
+
* The nesting level of the test.
|
|
1061
|
+
*/
|
|
1062
|
+
nesting: number;
|
|
1063
|
+
/**
|
|
1064
|
+
* The number of subtests that have ran.
|
|
1065
|
+
*/
|
|
1066
|
+
count: number;
|
|
1067
|
+
/**
|
|
1068
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
1069
|
+
*/
|
|
1070
|
+
file?: string;
|
|
1071
|
+
}
|
|
1072
|
+
interface TestStart {
|
|
1073
|
+
/**
|
|
1074
|
+
* The test name.
|
|
1075
|
+
*/
|
|
1076
|
+
name: string;
|
|
1077
|
+
/**
|
|
1078
|
+
* The nesting level of the test.
|
|
1079
|
+
*/
|
|
1080
|
+
nesting: number;
|
|
1081
|
+
/**
|
|
1082
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
1083
|
+
*/
|
|
1084
|
+
file?: string;
|
|
1085
|
+
}
|
|
1086
|
+
interface TestStderr {
|
|
1087
|
+
/**
|
|
1088
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
1089
|
+
*/
|
|
1090
|
+
file?: string;
|
|
1091
|
+
/**
|
|
1092
|
+
* The message written to `stderr`
|
|
1093
|
+
*/
|
|
1094
|
+
message: string;
|
|
1095
|
+
}
|
|
1096
|
+
interface TestStdout {
|
|
1097
|
+
/**
|
|
1098
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
1099
|
+
*/
|
|
1100
|
+
file?: string;
|
|
1101
|
+
/**
|
|
1102
|
+
* The message written to `stdout`
|
|
1103
|
+
*/
|
|
1104
|
+
message: string;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
/**
|
|
1108
|
+
* The `node:test/reporters` module exposes the builtin-reporters for `node:test`.
|
|
1109
|
+
* To access it:
|
|
1110
|
+
*
|
|
1111
|
+
* ```js
|
|
1112
|
+
* import test from 'node:test/reporters';
|
|
1113
|
+
* ```
|
|
1114
|
+
*
|
|
1115
|
+
* This module is only available under the `node:` scheme. The following will not
|
|
1116
|
+
* work:
|
|
1117
|
+
*
|
|
1118
|
+
* ```js
|
|
1119
|
+
* import test from 'test/reporters';
|
|
1120
|
+
* ```
|
|
1121
|
+
* @since v19.9.0
|
|
1122
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/test/reporters.js)
|
|
1123
|
+
*/
|
|
1124
|
+
declare module 'node:test/reporters' {
|
|
1125
|
+
import { Transform } from 'node:stream';
|
|
1126
|
+
|
|
1127
|
+
type TestEvent =
|
|
1128
|
+
| { type: 'test:diagnostic', data: DiagnosticData }
|
|
1129
|
+
| { type: 'test:fail', data: TestFail }
|
|
1130
|
+
| { type: 'test:pass', data: TestPass }
|
|
1131
|
+
| { type: 'test:plan', data: TestPlan }
|
|
1132
|
+
| { type: 'test:start', data: TestStart }
|
|
1133
|
+
| { type: 'test:stderr', data: TestStderr }
|
|
1134
|
+
| { type: 'test:stdout', data: TestStdout };
|
|
1135
|
+
type TestEventGenerator = AsyncGenerator<TestEvent, void>;
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* The `dot` reporter outputs the test results in a compact format,
|
|
1139
|
+
* where each passing test is represented by a `.`,
|
|
1140
|
+
* and each failing test is represented by a `X`.
|
|
1141
|
+
*/
|
|
1142
|
+
function dot(source: TestEventGenerator): AsyncGenerator<"\n" | "." | "X", void>;
|
|
1143
|
+
/**
|
|
1144
|
+
* The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format.
|
|
1145
|
+
*/
|
|
1146
|
+
function tap(source: TestEventGenerator): AsyncGenerator<string, void>;
|
|
1147
|
+
/**
|
|
1148
|
+
* The `spec` reporter outputs the test results in a human-readable format.
|
|
1149
|
+
*/
|
|
1150
|
+
class Spec extends Transform {
|
|
1151
|
+
constructor();
|
|
1152
|
+
}
|
|
1153
|
+
export { dot, tap, Spec as spec };
|
|
1154
|
+
}
|
node/ts4.8/cluster.d.ts
CHANGED
|
@@ -67,6 +67,8 @@ declare module 'cluster' {
|
|
|
67
67
|
gid?: number | undefined;
|
|
68
68
|
inspectPort?: number | (() => number) | undefined;
|
|
69
69
|
serialization?: SerializationType | undefined;
|
|
70
|
+
cwd?: string | undefined;
|
|
71
|
+
windowsHide?: boolean | undefined;
|
|
70
72
|
}
|
|
71
73
|
export interface Address {
|
|
72
74
|
address: string;
|
node/ts4.8/test.d.ts
CHANGED
|
@@ -307,134 +307,50 @@ declare module 'node:test' {
|
|
|
307
307
|
addListener(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
308
308
|
addListener(event: 'test:plan', listener: (data: TestPlan) => void): this;
|
|
309
309
|
addListener(event: 'test:start', listener: (data: TestStart) => void): this;
|
|
310
|
+
addListener(event: 'test:stderr', listener: (data: TestStderr) => void): this;
|
|
311
|
+
addListener(event: 'test:stdout', listener: (data: TestStdout) => void): this;
|
|
310
312
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
311
313
|
emit(event: 'test:diagnostic', data: DiagnosticData): boolean;
|
|
312
314
|
emit(event: 'test:fail', data: TestFail): boolean;
|
|
313
315
|
emit(event: 'test:pass', data: TestPass): boolean;
|
|
314
316
|
emit(event: 'test:plan', data: TestPlan): boolean;
|
|
315
317
|
emit(event: 'test:start', data: TestStart): boolean;
|
|
318
|
+
emit(event: 'test:stderr', data: TestStderr): boolean;
|
|
319
|
+
emit(event: 'test:stdout', data: TestStdout): boolean;
|
|
316
320
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
317
321
|
on(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this;
|
|
318
322
|
on(event: 'test:fail', listener: (data: TestFail) => void): this;
|
|
319
323
|
on(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
320
324
|
on(event: 'test:plan', listener: (data: TestPlan) => void): this;
|
|
321
325
|
on(event: 'test:start', listener: (data: TestStart) => void): this;
|
|
326
|
+
on(event: 'test:stderr', listener: (data: TestStderr) => void): this;
|
|
327
|
+
on(event: 'test:stdout', listener: (data: TestStdout) => void): this;
|
|
322
328
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
323
329
|
once(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this;
|
|
324
330
|
once(event: 'test:fail', listener: (data: TestFail) => void): this;
|
|
325
331
|
once(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
326
332
|
once(event: 'test:plan', listener: (data: TestPlan) => void): this;
|
|
327
333
|
once(event: 'test:start', listener: (data: TestStart) => void): this;
|
|
334
|
+
once(event: 'test:stderr', listener: (data: TestStderr) => void): this;
|
|
335
|
+
once(event: 'test:stdout', listener: (data: TestStdout) => void): this;
|
|
328
336
|
once(event: string, listener: (...args: any[]) => void): this;
|
|
329
337
|
prependListener(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this;
|
|
330
338
|
prependListener(event: 'test:fail', listener: (data: TestFail) => void): this;
|
|
331
339
|
prependListener(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
332
340
|
prependListener(event: 'test:plan', listener: (data: TestPlan) => void): this;
|
|
333
341
|
prependListener(event: 'test:start', listener: (data: TestStart) => void): this;
|
|
342
|
+
prependListener(event: 'test:stderr', listener: (data: TestStderr) => void): this;
|
|
343
|
+
prependListener(event: 'test:stdout', listener: (data: TestStdout) => void): this;
|
|
334
344
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
335
345
|
prependOnceListener(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this;
|
|
336
346
|
prependOnceListener(event: 'test:fail', listener: (data: TestFail) => void): this;
|
|
337
347
|
prependOnceListener(event: 'test:pass', listener: (data: TestPass) => void): this;
|
|
338
348
|
prependOnceListener(event: 'test:plan', listener: (data: TestPlan) => void): this;
|
|
339
349
|
prependOnceListener(event: 'test:start', listener: (data: TestStart) => void): this;
|
|
350
|
+
prependOnceListener(event: 'test:stderr', listener: (data: TestStderr) => void): this;
|
|
351
|
+
prependOnceListener(event: 'test:stdout', listener: (data: TestStdout) => void): this;
|
|
340
352
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
341
353
|
}
|
|
342
|
-
interface DiagnosticData {
|
|
343
|
-
/**
|
|
344
|
-
* The diagnostic message.
|
|
345
|
-
*/
|
|
346
|
-
message: string;
|
|
347
|
-
/**
|
|
348
|
-
* The nesting level of the test.
|
|
349
|
-
*/
|
|
350
|
-
nesting: number;
|
|
351
|
-
}
|
|
352
|
-
interface TestFail {
|
|
353
|
-
/**
|
|
354
|
-
* Additional execution metadata.
|
|
355
|
-
*/
|
|
356
|
-
details: {
|
|
357
|
-
/**
|
|
358
|
-
* The duration of the test in milliseconds.
|
|
359
|
-
*/
|
|
360
|
-
duration: number;
|
|
361
|
-
/**
|
|
362
|
-
* The error thrown by the test.
|
|
363
|
-
*/
|
|
364
|
-
error: Error;
|
|
365
|
-
};
|
|
366
|
-
/**
|
|
367
|
-
* The test name.
|
|
368
|
-
*/
|
|
369
|
-
name: string;
|
|
370
|
-
/**
|
|
371
|
-
* The nesting level of the test.
|
|
372
|
-
*/
|
|
373
|
-
nesting: number;
|
|
374
|
-
/**
|
|
375
|
-
* The ordinal number of the test.
|
|
376
|
-
*/
|
|
377
|
-
testNumber: number;
|
|
378
|
-
/**
|
|
379
|
-
* Present if `context.todo` is called.
|
|
380
|
-
*/
|
|
381
|
-
todo?: string | boolean;
|
|
382
|
-
/**
|
|
383
|
-
* Present if `context.skip` is called.
|
|
384
|
-
*/
|
|
385
|
-
skip?: string | boolean;
|
|
386
|
-
}
|
|
387
|
-
interface TestPass {
|
|
388
|
-
/**
|
|
389
|
-
* Additional execution metadata.
|
|
390
|
-
*/
|
|
391
|
-
details: {
|
|
392
|
-
/**
|
|
393
|
-
* The duration of the test in milliseconds.
|
|
394
|
-
*/
|
|
395
|
-
duration: number;
|
|
396
|
-
};
|
|
397
|
-
/**
|
|
398
|
-
* The test name.
|
|
399
|
-
*/
|
|
400
|
-
name: string;
|
|
401
|
-
/**
|
|
402
|
-
* The nesting level of the test.
|
|
403
|
-
*/
|
|
404
|
-
nesting: number;
|
|
405
|
-
/**
|
|
406
|
-
* The ordinal number of the test.
|
|
407
|
-
*/
|
|
408
|
-
testNumber: number;
|
|
409
|
-
/**
|
|
410
|
-
* Present if `context.todo` is called.
|
|
411
|
-
*/
|
|
412
|
-
todo?: string | boolean;
|
|
413
|
-
/**
|
|
414
|
-
* Present if `context.skip` is called.
|
|
415
|
-
*/
|
|
416
|
-
skip?: string | boolean;
|
|
417
|
-
}
|
|
418
|
-
interface TestPlan {
|
|
419
|
-
/**
|
|
420
|
-
* The nesting level of the test.
|
|
421
|
-
*/
|
|
422
|
-
nesting: number;
|
|
423
|
-
/**
|
|
424
|
-
* The number of subtests that have ran.
|
|
425
|
-
*/
|
|
426
|
-
count: number;
|
|
427
|
-
}
|
|
428
|
-
interface TestStart {
|
|
429
|
-
/**
|
|
430
|
-
* The test name.
|
|
431
|
-
*/
|
|
432
|
-
name: string;
|
|
433
|
-
/**
|
|
434
|
-
* The nesting level of the test.
|
|
435
|
-
*/
|
|
436
|
-
nesting: number;
|
|
437
|
-
}
|
|
438
354
|
/**
|
|
439
355
|
* An instance of `TestContext` is passed to each test function in order to
|
|
440
356
|
* interact with the test runner. However, the `TestContext` constructor is not
|
|
@@ -1050,3 +966,189 @@ declare module 'node:test' {
|
|
|
1050
966
|
}
|
|
1051
967
|
export { test as default, run, test, describe, it, before, after, beforeEach, afterEach, mock, skip, only, todo };
|
|
1052
968
|
}
|
|
969
|
+
|
|
970
|
+
interface DiagnosticData {
|
|
971
|
+
/**
|
|
972
|
+
* The diagnostic message.
|
|
973
|
+
*/
|
|
974
|
+
message: string;
|
|
975
|
+
/**
|
|
976
|
+
* The nesting level of the test.
|
|
977
|
+
*/
|
|
978
|
+
nesting: number;
|
|
979
|
+
/**
|
|
980
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
981
|
+
*/
|
|
982
|
+
file?: string;
|
|
983
|
+
}
|
|
984
|
+
interface TestFail {
|
|
985
|
+
/**
|
|
986
|
+
* Additional execution metadata.
|
|
987
|
+
*/
|
|
988
|
+
details: {
|
|
989
|
+
/**
|
|
990
|
+
* The duration of the test in milliseconds.
|
|
991
|
+
*/
|
|
992
|
+
duration: number;
|
|
993
|
+
/**
|
|
994
|
+
* The error thrown by the test.
|
|
995
|
+
*/
|
|
996
|
+
error: Error;
|
|
997
|
+
};
|
|
998
|
+
/**
|
|
999
|
+
* The test name.
|
|
1000
|
+
*/
|
|
1001
|
+
name: string;
|
|
1002
|
+
/**
|
|
1003
|
+
* The nesting level of the test.
|
|
1004
|
+
*/
|
|
1005
|
+
nesting: number;
|
|
1006
|
+
/**
|
|
1007
|
+
* The ordinal number of the test.
|
|
1008
|
+
*/
|
|
1009
|
+
testNumber: number;
|
|
1010
|
+
/**
|
|
1011
|
+
* Present if `context.todo` is called.
|
|
1012
|
+
*/
|
|
1013
|
+
todo?: string | boolean;
|
|
1014
|
+
/**
|
|
1015
|
+
* Present if `context.skip` is called.
|
|
1016
|
+
*/
|
|
1017
|
+
skip?: string | boolean;
|
|
1018
|
+
/**
|
|
1019
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
1020
|
+
*/
|
|
1021
|
+
file?: string;
|
|
1022
|
+
}
|
|
1023
|
+
interface TestPass {
|
|
1024
|
+
/**
|
|
1025
|
+
* Additional execution metadata.
|
|
1026
|
+
*/
|
|
1027
|
+
details: {
|
|
1028
|
+
/**
|
|
1029
|
+
* The duration of the test in milliseconds.
|
|
1030
|
+
*/
|
|
1031
|
+
duration: number;
|
|
1032
|
+
};
|
|
1033
|
+
/**
|
|
1034
|
+
* The test name.
|
|
1035
|
+
*/
|
|
1036
|
+
name: string;
|
|
1037
|
+
/**
|
|
1038
|
+
* The nesting level of the test.
|
|
1039
|
+
*/
|
|
1040
|
+
nesting: number;
|
|
1041
|
+
/**
|
|
1042
|
+
* The ordinal number of the test.
|
|
1043
|
+
*/
|
|
1044
|
+
testNumber: number;
|
|
1045
|
+
/**
|
|
1046
|
+
* Present if `context.todo` is called.
|
|
1047
|
+
*/
|
|
1048
|
+
todo?: string | boolean;
|
|
1049
|
+
/**
|
|
1050
|
+
* Present if `context.skip` is called.
|
|
1051
|
+
*/
|
|
1052
|
+
skip?: string | boolean;
|
|
1053
|
+
/**
|
|
1054
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
1055
|
+
*/
|
|
1056
|
+
file?: string;
|
|
1057
|
+
}
|
|
1058
|
+
interface TestPlan {
|
|
1059
|
+
/**
|
|
1060
|
+
* The nesting level of the test.
|
|
1061
|
+
*/
|
|
1062
|
+
nesting: number;
|
|
1063
|
+
/**
|
|
1064
|
+
* The number of subtests that have ran.
|
|
1065
|
+
*/
|
|
1066
|
+
count: number;
|
|
1067
|
+
/**
|
|
1068
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
1069
|
+
*/
|
|
1070
|
+
file?: string;
|
|
1071
|
+
}
|
|
1072
|
+
interface TestStart {
|
|
1073
|
+
/**
|
|
1074
|
+
* The test name.
|
|
1075
|
+
*/
|
|
1076
|
+
name: string;
|
|
1077
|
+
/**
|
|
1078
|
+
* The nesting level of the test.
|
|
1079
|
+
*/
|
|
1080
|
+
nesting: number;
|
|
1081
|
+
/**
|
|
1082
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
1083
|
+
*/
|
|
1084
|
+
file?: string;
|
|
1085
|
+
}
|
|
1086
|
+
interface TestStderr {
|
|
1087
|
+
/**
|
|
1088
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
1089
|
+
*/
|
|
1090
|
+
file?: string;
|
|
1091
|
+
/**
|
|
1092
|
+
* The message written to `stderr`
|
|
1093
|
+
*/
|
|
1094
|
+
message: string;
|
|
1095
|
+
}
|
|
1096
|
+
interface TestStdout {
|
|
1097
|
+
/**
|
|
1098
|
+
* The path of the test file, undefined if test is not ran through a file.
|
|
1099
|
+
*/
|
|
1100
|
+
file?: string;
|
|
1101
|
+
/**
|
|
1102
|
+
* The message written to `stdout`
|
|
1103
|
+
*/
|
|
1104
|
+
message: string;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
/**
|
|
1108
|
+
* The `node:test/reporters` module exposes the builtin-reporters for `node:test`.
|
|
1109
|
+
* To access it:
|
|
1110
|
+
*
|
|
1111
|
+
* ```js
|
|
1112
|
+
* import test from 'node:test/reporters';
|
|
1113
|
+
* ```
|
|
1114
|
+
*
|
|
1115
|
+
* This module is only available under the `node:` scheme. The following will not
|
|
1116
|
+
* work:
|
|
1117
|
+
*
|
|
1118
|
+
* ```js
|
|
1119
|
+
* import test from 'test/reporters';
|
|
1120
|
+
* ```
|
|
1121
|
+
* @since v19.9.0
|
|
1122
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/test/reporters.js)
|
|
1123
|
+
*/
|
|
1124
|
+
declare module 'node:test/reporters' {
|
|
1125
|
+
import { Transform } from 'node:stream';
|
|
1126
|
+
|
|
1127
|
+
type TestEvent =
|
|
1128
|
+
| { type: 'test:diagnostic', data: DiagnosticData }
|
|
1129
|
+
| { type: 'test:fail', data: TestFail }
|
|
1130
|
+
| { type: 'test:pass', data: TestPass }
|
|
1131
|
+
| { type: 'test:plan', data: TestPlan }
|
|
1132
|
+
| { type: 'test:start', data: TestStart }
|
|
1133
|
+
| { type: 'test:stderr', data: TestStderr }
|
|
1134
|
+
| { type: 'test:stdout', data: TestStdout };
|
|
1135
|
+
type TestEventGenerator = AsyncGenerator<TestEvent, void>;
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* The `dot` reporter outputs the test results in a compact format,
|
|
1139
|
+
* where each passing test is represented by a `.`,
|
|
1140
|
+
* and each failing test is represented by a `X`.
|
|
1141
|
+
*/
|
|
1142
|
+
function dot(source: TestEventGenerator): AsyncGenerator<"\n" | "." | "X", void>;
|
|
1143
|
+
/**
|
|
1144
|
+
* The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format.
|
|
1145
|
+
*/
|
|
1146
|
+
function tap(source: TestEventGenerator): AsyncGenerator<string, void>;
|
|
1147
|
+
/**
|
|
1148
|
+
* The `spec` reporter outputs the test results in a human-readable format.
|
|
1149
|
+
*/
|
|
1150
|
+
class Spec extends Transform {
|
|
1151
|
+
constructor();
|
|
1152
|
+
}
|
|
1153
|
+
export { dot, tap, Spec as spec };
|
|
1154
|
+
}
|