@types/node 20.4.6 → 20.4.8

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.
Files changed (4) hide show
  1. node/README.md +1 -1
  2. node/package.json +2 -2
  3. node/test.d.ts +54 -5
  4. node/ts4.8/test.d.ts +53 -4
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: Wed, 02 Aug 2023 18:33:09 GMT
11
+ * Last updated: Sat, 05 Aug 2023 10:32:49 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
14
14
 
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "20.4.6",
3
+ "version": "20.4.8",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -227,6 +227,6 @@
227
227
  },
228
228
  "scripts": {},
229
229
  "dependencies": {},
230
- "typesPublisherContentHash": "ab20eb668111bd3ce78d36563f637a0eb74a8cb966a70f0ee0ac56d66c5fc0b2",
230
+ "typesPublisherContentHash": "9acef897909a6e2f2e35b1241c4aee3acd41d6d87a7676afe8d21d5c84e063ad",
231
231
  "typeScriptVersion": "4.3"
232
232
  }
node/test.d.ts CHANGED
@@ -76,10 +76,11 @@
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.2.0/lib/test.js)
79
+ * @see [source](https://github.com/nodejs/node/blob/v20.4.0/lib/test.js)
80
80
  */
81
81
  declare module 'node:test' {
82
82
  import { Readable } from 'node:stream';
83
+ import { AsyncResource } from 'node:async_hooks';
83
84
  /**
84
85
  * ```js
85
86
  * import { tap } from 'node:test/reporters';
@@ -295,6 +296,23 @@ declare module 'node:test' {
295
296
  * For each test that is executed, any corresponding test hooks, such as `beforeEach()`, are also run.
296
297
  */
297
298
  testNamePatterns?: string | RegExp | string[] | RegExp[];
299
+ /**
300
+ * A function that accepts the TestsStream instance and can be used to setup listeners before any tests are run.
301
+ */
302
+ setup?: (root: Test) => void | Promise<void>;
303
+ /**
304
+ * Whether to run in watch mode or not. Default: false.
305
+ */
306
+ watch?: boolean;
307
+ }
308
+ class Test extends AsyncResource {
309
+ concurrency: number;
310
+ nesting: number;
311
+ only: boolean;
312
+ reporter: TestsStream;
313
+ runOnlySubtests: boolean;
314
+ testNumber: number;
315
+ timeout: number | null;
298
316
  }
299
317
  /**
300
318
  * 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
@@ -1218,7 +1236,7 @@ interface TestFail {
1218
1236
  /**
1219
1237
  * The duration of the test in milliseconds.
1220
1238
  */
1221
- duration: number;
1239
+ duration_ms: number;
1222
1240
  /**
1223
1241
  * The error thrown by the test.
1224
1242
  */
@@ -1257,7 +1275,7 @@ interface TestPass {
1257
1275
  /**
1258
1276
  * The duration of the test in milliseconds.
1259
1277
  */
1260
- duration: number;
1278
+ duration_ms: number;
1261
1279
  };
1262
1280
  /**
1263
1281
  * The test name.
@@ -1332,6 +1350,34 @@ interface TestStdout {
1332
1350
  */
1333
1351
  message: string;
1334
1352
  }
1353
+ interface TestEnqueue {
1354
+ /**
1355
+ * The test name
1356
+ */
1357
+ name: string;
1358
+ /**
1359
+ * The path of the test file, undefined if test is not ran through a file.
1360
+ */
1361
+ file?: string;
1362
+ /**
1363
+ * The nesting level of the test.
1364
+ */
1365
+ nesting: number;
1366
+ }
1367
+ interface TestDequeue {
1368
+ /**
1369
+ * The test name
1370
+ */
1371
+ name: string;
1372
+ /**
1373
+ * The path of the test file, undefined if test is not ran through a file.
1374
+ */
1375
+ file?: string;
1376
+ /**
1377
+ * The nesting level of the test.
1378
+ */
1379
+ nesting: number;
1380
+ }
1335
1381
 
1336
1382
  /**
1337
1383
  * The `node:test/reporters` module exposes the builtin-reporters for `node:test`.
@@ -1360,7 +1406,10 @@ declare module 'node:test/reporters' {
1360
1406
  | { type: 'test:plan', data: TestPlan }
1361
1407
  | { type: 'test:start', data: TestStart }
1362
1408
  | { type: 'test:stderr', data: TestStderr }
1363
- | { type: 'test:stdout', data: TestStdout };
1409
+ | { type: 'test:stdout', data: TestStdout }
1410
+ | { type: 'test:enqueue', data: TestEnqueue }
1411
+ | { type: 'test:dequeue', data: TestDequeue }
1412
+ | { type: 'test:watch:drained' };
1364
1413
  type TestEventGenerator = AsyncGenerator<TestEvent, void>;
1365
1414
 
1366
1415
  /**
@@ -1379,5 +1428,5 @@ declare module 'node:test/reporters' {
1379
1428
  class Spec extends Transform {
1380
1429
  constructor();
1381
1430
  }
1382
- export { dot, tap, Spec as spec };
1431
+ export { dot, tap, Spec as spec, TestEvent };
1383
1432
  }
node/ts4.8/test.d.ts CHANGED
@@ -80,6 +80,7 @@
80
80
  */
81
81
  declare module 'node:test' {
82
82
  import { Readable } from 'node:stream';
83
+ import { AsyncResource } from 'node:async_hooks';
83
84
  /**
84
85
  * ```js
85
86
  * import { tap } from 'node:test/reporters';
@@ -295,6 +296,23 @@ declare module 'node:test' {
295
296
  * For each test that is executed, any corresponding test hooks, such as `beforeEach()`, are also run.
296
297
  */
297
298
  testNamePatterns?: string | RegExp | string[] | RegExp[];
299
+ /**
300
+ * A function that accepts the TestsStream instance and can be used to setup listeners before any tests are run.
301
+ */
302
+ setup?: (root: unknown) => void | Promise<void>;
303
+ /**
304
+ * Whether to run in watch mode or not. Default: false.
305
+ */
306
+ watch?: boolean;
307
+ }
308
+ class Test extends AsyncResource {
309
+ concurrency: number;
310
+ nesting: number;
311
+ only: boolean;
312
+ reporter: TestsStream;
313
+ runOnlySubtests: boolean;
314
+ testNumber: number;
315
+ timeout: number | null;
298
316
  }
299
317
  /**
300
318
  * 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
@@ -1200,7 +1218,7 @@ interface TestFail {
1200
1218
  /**
1201
1219
  * The duration of the test in milliseconds.
1202
1220
  */
1203
- duration: number;
1221
+ duration_ms: number;
1204
1222
  /**
1205
1223
  * The error thrown by the test.
1206
1224
  */
@@ -1239,7 +1257,7 @@ interface TestPass {
1239
1257
  /**
1240
1258
  * The duration of the test in milliseconds.
1241
1259
  */
1242
- duration: number;
1260
+ duration_ms: number;
1243
1261
  };
1244
1262
  /**
1245
1263
  * The test name.
@@ -1314,6 +1332,34 @@ interface TestStdout {
1314
1332
  */
1315
1333
  message: string;
1316
1334
  }
1335
+ interface TestEnqueue {
1336
+ /**
1337
+ * The test name
1338
+ */
1339
+ name: string;
1340
+ /**
1341
+ * The path of the test file, undefined if test is not ran through a file.
1342
+ */
1343
+ file?: string;
1344
+ /**
1345
+ * The nesting level of the test.
1346
+ */
1347
+ nesting: number;
1348
+ }
1349
+ interface TestDequeue {
1350
+ /**
1351
+ * The test name
1352
+ */
1353
+ name: string;
1354
+ /**
1355
+ * The path of the test file, undefined if test is not ran through a file.
1356
+ */
1357
+ file?: string;
1358
+ /**
1359
+ * The nesting level of the test.
1360
+ */
1361
+ nesting: number;
1362
+ }
1317
1363
 
1318
1364
  /**
1319
1365
  * The `node:test/reporters` module exposes the builtin-reporters for `node:test`.
@@ -1342,7 +1388,10 @@ declare module 'node:test/reporters' {
1342
1388
  | { type: 'test:plan', data: TestPlan }
1343
1389
  | { type: 'test:start', data: TestStart }
1344
1390
  | { type: 'test:stderr', data: TestStderr }
1345
- | { type: 'test:stdout', data: TestStdout };
1391
+ | { type: 'test:stdout', data: TestStdout }
1392
+ | { type: 'test:enqueue', data: TestEnqueue }
1393
+ | { type: 'test:dequeue', data: TestDequeue }
1394
+ | { type: 'test:watch:drained' };
1346
1395
  type TestEventGenerator = AsyncGenerator<TestEvent, void>;
1347
1396
 
1348
1397
  /**
@@ -1361,5 +1410,5 @@ declare module 'node:test/reporters' {
1361
1410
  class Spec extends Transform {
1362
1411
  constructor();
1363
1412
  }
1364
- export { dot, tap, Spec as spec };
1413
+ export { dot, tap, Spec as spec, TestEvent };
1365
1414
  }