@types/node 18.17.19 → 18.18.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.
Files changed (111) hide show
  1. {node v18.17 → node v18.18}/README.md +1 -1
  2. {node v18.17 → node v18.18}/child_process.d.ts +5 -0
  3. {node v18.17/ts4.8 → node v18.18}/dgram.d.ts +5 -0
  4. {node v18.17 → node v18.18}/events.d.ts +35 -0
  5. {node v18.17 → node v18.18}/fs/promises.d.ts +5 -0
  6. {node v18.17 → node v18.18}/globals.d.ts +22 -0
  7. {node v18.17 → node v18.18}/index.d.ts +1 -1
  8. {node v18.17/ts4.8 → node v18.18}/module.d.ts +45 -4
  9. {node v18.17/ts4.8 → node v18.18}/net.d.ts +11 -6
  10. {node v18.17 → node v18.18}/package.json +2 -2
  11. {node v18.17 → node v18.18}/stream.d.ts +5 -0
  12. {node v18.17 → node v18.18}/test.d.ts +55 -40
  13. {node v18.17 → node v18.18}/timers.d.ts +12 -2
  14. {node v18.17 → node v18.18}/ts4.8/child_process.d.ts +5 -0
  15. {node v18.17 → node v18.18/ts4.8}/dgram.d.ts +5 -0
  16. {node v18.17 → node v18.18}/ts4.8/events.d.ts +35 -0
  17. {node v18.17 → node v18.18}/ts4.8/fs/promises.d.ts +5 -0
  18. {node v18.17 → node v18.18}/ts4.8/globals.d.ts +24 -1
  19. {node v18.17 → node v18.18/ts4.8}/module.d.ts +45 -4
  20. {node v18.17 → node v18.18/ts4.8}/net.d.ts +5 -0
  21. {node v18.17 → node v18.18}/ts4.8/stream.d.ts +169 -0
  22. {node v18.17 → node v18.18}/ts4.8/test.d.ts +69 -40
  23. {node v18.17 → node v18.18}/ts4.8/timers.d.ts +19 -2
  24. {node v18.17 → node v18.18}/ts4.8/url.d.ts +13 -4
  25. {node v18.17 → node v18.18}/url.d.ts +13 -4
  26. {node v18.17 → node v18.18}/LICENSE +0 -0
  27. {node v18.17 → node v18.18}/assert/strict.d.ts +0 -0
  28. {node v18.17 → node v18.18}/assert.d.ts +0 -0
  29. {node v18.17 → node v18.18}/async_hooks.d.ts +0 -0
  30. {node v18.17 → node v18.18}/buffer.d.ts +0 -0
  31. {node v18.17 → node v18.18}/cluster.d.ts +0 -0
  32. {node v18.17 → node v18.18}/console.d.ts +0 -0
  33. {node v18.17 → node v18.18}/constants.d.ts +0 -0
  34. {node v18.17 → node v18.18}/crypto.d.ts +0 -0
  35. {node v18.17 → node v18.18}/diagnostics_channel.d.ts +0 -0
  36. {node v18.17 → node v18.18}/dns/promises.d.ts +0 -0
  37. {node v18.17 → node v18.18}/dns.d.ts +0 -0
  38. {node v18.17 → node v18.18}/dom-events.d.ts +0 -0
  39. {node v18.17 → node v18.18}/domain.d.ts +0 -0
  40. {node v18.17 → node v18.18}/fs.d.ts +0 -0
  41. {node v18.17 → node v18.18}/globals.global.d.ts +0 -0
  42. {node v18.17 → node v18.18}/http.d.ts +0 -0
  43. {node v18.17 → node v18.18}/http2.d.ts +0 -0
  44. {node v18.17 → node v18.18}/https.d.ts +0 -0
  45. {node v18.17 → node v18.18}/inspector.d.ts +0 -0
  46. {node v18.17 → node v18.18}/os.d.ts +0 -0
  47. {node v18.17 → node v18.18}/path.d.ts +0 -0
  48. {node v18.17 → node v18.18}/perf_hooks.d.ts +0 -0
  49. {node v18.17 → node v18.18}/process.d.ts +0 -0
  50. {node v18.17 → node v18.18}/punycode.d.ts +0 -0
  51. {node v18.17 → node v18.18}/querystring.d.ts +0 -0
  52. {node v18.17 → node v18.18}/readline/promises.d.ts +0 -0
  53. {node v18.17 → node v18.18}/readline.d.ts +0 -0
  54. {node v18.17 → node v18.18}/repl.d.ts +0 -0
  55. {node v18.17 → node v18.18}/stream/consumers.d.ts +0 -0
  56. {node v18.17 → node v18.18}/stream/promises.d.ts +0 -0
  57. {node v18.17 → node v18.18}/stream/web.d.ts +0 -0
  58. {node v18.17 → node v18.18}/string_decoder.d.ts +0 -0
  59. {node v18.17 → node v18.18}/timers/promises.d.ts +0 -0
  60. {node v18.17 → node v18.18}/tls.d.ts +0 -0
  61. {node v18.17 → node v18.18}/trace_events.d.ts +0 -0
  62. {node v18.17 → node v18.18}/ts4.8/assert/strict.d.ts +0 -0
  63. {node v18.17 → node v18.18}/ts4.8/assert.d.ts +0 -0
  64. {node v18.17 → node v18.18}/ts4.8/async_hooks.d.ts +0 -0
  65. {node v18.17 → node v18.18}/ts4.8/buffer.d.ts +0 -0
  66. {node v18.17 → node v18.18}/ts4.8/cluster.d.ts +0 -0
  67. {node v18.17 → node v18.18}/ts4.8/console.d.ts +0 -0
  68. {node v18.17 → node v18.18}/ts4.8/constants.d.ts +0 -0
  69. {node v18.17 → node v18.18}/ts4.8/crypto.d.ts +0 -0
  70. {node v18.17 → node v18.18}/ts4.8/diagnostics_channel.d.ts +0 -0
  71. {node v18.17 → node v18.18}/ts4.8/dns/promises.d.ts +0 -0
  72. {node v18.17 → node v18.18}/ts4.8/dns.d.ts +0 -0
  73. {node v18.17 → node v18.18}/ts4.8/dom-events.d.ts +0 -0
  74. {node v18.17 → node v18.18}/ts4.8/domain.d.ts +0 -0
  75. {node v18.17 → node v18.18}/ts4.8/fs.d.ts +0 -0
  76. {node v18.17 → node v18.18}/ts4.8/globals.global.d.ts +0 -0
  77. {node v18.17 → node v18.18}/ts4.8/http.d.ts +0 -0
  78. {node v18.17 → node v18.18}/ts4.8/http2.d.ts +0 -0
  79. {node v18.17 → node v18.18}/ts4.8/https.d.ts +0 -0
  80. {node v18.17 → node v18.18}/ts4.8/index.d.ts +0 -0
  81. {node v18.17 → node v18.18}/ts4.8/inspector.d.ts +0 -0
  82. {node v18.17 → node v18.18}/ts4.8/os.d.ts +0 -0
  83. {node v18.17 → node v18.18}/ts4.8/path.d.ts +0 -0
  84. {node v18.17 → node v18.18}/ts4.8/perf_hooks.d.ts +0 -0
  85. {node v18.17 → node v18.18}/ts4.8/process.d.ts +0 -0
  86. {node v18.17 → node v18.18}/ts4.8/punycode.d.ts +0 -0
  87. {node v18.17 → node v18.18}/ts4.8/querystring.d.ts +0 -0
  88. {node v18.17 → node v18.18}/ts4.8/readline/promises.d.ts +0 -0
  89. {node v18.17 → node v18.18}/ts4.8/readline.d.ts +0 -0
  90. {node v18.17 → node v18.18}/ts4.8/repl.d.ts +0 -0
  91. {node v18.17 → node v18.18}/ts4.8/stream/consumers.d.ts +0 -0
  92. {node v18.17 → node v18.18}/ts4.8/stream/promises.d.ts +0 -0
  93. {node v18.17 → node v18.18}/ts4.8/stream/web.d.ts +0 -0
  94. {node v18.17 → node v18.18}/ts4.8/string_decoder.d.ts +0 -0
  95. {node v18.17 → node v18.18}/ts4.8/timers/promises.d.ts +0 -0
  96. {node v18.17 → node v18.18}/ts4.8/tls.d.ts +0 -0
  97. {node v18.17 → node v18.18}/ts4.8/trace_events.d.ts +0 -0
  98. {node v18.17 → node v18.18}/ts4.8/tty.d.ts +0 -0
  99. {node v18.17 → node v18.18}/ts4.8/util.d.ts +0 -0
  100. {node v18.17 → node v18.18}/ts4.8/v8.d.ts +0 -0
  101. {node v18.17 → node v18.18}/ts4.8/vm.d.ts +0 -0
  102. {node v18.17 → node v18.18}/ts4.8/wasi.d.ts +0 -0
  103. {node v18.17 → node v18.18}/ts4.8/worker_threads.d.ts +0 -0
  104. {node v18.17 → node v18.18}/ts4.8/zlib.d.ts +0 -0
  105. {node v18.17 → node v18.18}/tty.d.ts +0 -0
  106. {node v18.17 → node v18.18}/util.d.ts +0 -0
  107. {node v18.17 → node v18.18}/v8.d.ts +0 -0
  108. {node v18.17 → node v18.18}/vm.d.ts +0 -0
  109. {node v18.17 → node v18.18}/wasi.d.ts +0 -0
  110. {node v18.17 → node v18.18}/worker_threads.d.ts +0 -0
  111. {node v18.17 → node v18.18}/zlib.d.ts +0 -0
@@ -53,6 +53,12 @@ declare module "stream" {
53
53
  encoding?: BufferEncoding | undefined;
54
54
  read?(this: Readable, size: number): void;
55
55
  }
56
+ interface ArrayOptions {
57
+ /** the maximum concurrent invocations of `fn` to call on the stream at once. **Default: 1**. */
58
+ concurrency?: number;
59
+ /** allows destroying the stream if the signal is aborted. */
60
+ signal?: AbortSignal;
61
+ }
56
62
  /**
57
63
  * @since v0.9.4
58
64
  */
@@ -430,6 +436,164 @@ declare module "stream" {
430
436
  */
431
437
  wrap(stream: NodeJS.ReadableStream): this;
432
438
  push(chunk: any, encoding?: BufferEncoding): boolean;
439
+ /**
440
+ * The iterator created by this method gives users the option to cancel the destruction
441
+ * of the stream if the `for await...of` loop is exited by `return`, `break`, or `throw`,
442
+ * or if the iterator should destroy the stream if the stream emitted an error during iteration.
443
+ * @since v16.3.0
444
+ * @param options.destroyOnReturn When set to `false`, calling `return` on the async iterator,
445
+ * or exiting a `for await...of` iteration using a `break`, `return`, or `throw` will not destroy the stream.
446
+ * **Default: `true`**.
447
+ */
448
+ iterator(options?: { destroyOnReturn?: boolean }): AsyncIterableIterator<any>;
449
+ /**
450
+ * This method allows mapping over the stream. The *fn* function will be called for every chunk in the stream.
451
+ * If the *fn* function returns a promise - that promise will be `await`ed before being passed to the result stream.
452
+ * @since v17.4.0, v16.14.0
453
+ * @param fn a function to map over every chunk in the stream. Async or not.
454
+ * @returns a stream mapped with the function *fn*.
455
+ */
456
+ map(fn: (data: any, options?: Pick<ArrayOptions, "signal">) => any, options?: ArrayOptions): Readable;
457
+ /**
458
+ * This method allows filtering the stream. For each chunk in the stream the *fn* function will be called
459
+ * and if it returns a truthy value, the chunk will be passed to the result stream.
460
+ * If the *fn* function returns a promise - that promise will be `await`ed.
461
+ * @since v17.4.0, v16.14.0
462
+ * @param fn a function to filter chunks from the stream. Async or not.
463
+ * @returns a stream filtered with the predicate *fn*.
464
+ */
465
+ filter(
466
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,
467
+ options?: ArrayOptions,
468
+ ): Readable;
469
+ /**
470
+ * This method allows iterating a stream. For each chunk in the stream the *fn* function will be called.
471
+ * If the *fn* function returns a promise - that promise will be `await`ed.
472
+ *
473
+ * This method is different from `for await...of` loops in that it can optionally process chunks concurrently.
474
+ * In addition, a `forEach` iteration can only be stopped by having passed a `signal` option
475
+ * and aborting the related AbortController while `for await...of` can be stopped with `break` or `return`.
476
+ * In either case the stream will be destroyed.
477
+ *
478
+ * This method is different from listening to the `'data'` event in that it uses the `readable` event
479
+ * in the underlying machinary and can limit the number of concurrent *fn* calls.
480
+ * @since v17.5.0
481
+ * @param fn a function to call on each chunk of the stream. Async or not.
482
+ * @returns a promise for when the stream has finished.
483
+ */
484
+ forEach(
485
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => void | Promise<void>,
486
+ options?: ArrayOptions,
487
+ ): Promise<void>;
488
+ /**
489
+ * This method allows easily obtaining the contents of a stream.
490
+ *
491
+ * As this method reads the entire stream into memory, it negates the benefits of streams. It's intended
492
+ * for interoperability and convenience, not as the primary way to consume streams.
493
+ * @since v17.5.0
494
+ * @returns a promise containing an array with the contents of the stream.
495
+ */
496
+ toArray(options?: Pick<ArrayOptions, "signal">): Promise<any[]>;
497
+ /**
498
+ * This method is similar to `Array.prototype.some` and calls *fn* on each chunk in the stream
499
+ * until the awaited return value is `true` (or any truthy value). Once an *fn* call on a chunk
500
+ * `await`ed return value is truthy, the stream is destroyed and the promise is fulfilled with `true`.
501
+ * If none of the *fn* calls on the chunks return a truthy value, the promise is fulfilled with `false`.
502
+ * @since v17.5.0
503
+ * @param fn a function to call on each chunk of the stream. Async or not.
504
+ * @returns a promise evaluating to `true` if *fn* returned a truthy value for at least one of the chunks.
505
+ */
506
+ some(
507
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,
508
+ options?: ArrayOptions,
509
+ ): Promise<boolean>;
510
+ /**
511
+ * This method is similar to `Array.prototype.find` and calls *fn* on each chunk in the stream
512
+ * to find a chunk with a truthy value for *fn*. Once an *fn* call's awaited return value is truthy,
513
+ * the stream is destroyed and the promise is fulfilled with value for which *fn* returned a truthy value.
514
+ * If all of the *fn* calls on the chunks return a falsy value, the promise is fulfilled with `undefined`.
515
+ * @since v17.5.0
516
+ * @param fn a function to call on each chunk of the stream. Async or not.
517
+ * @returns a promise evaluating to the first chunk for which *fn* evaluated with a truthy value,
518
+ * or `undefined` if no element was found.
519
+ */
520
+ find<T>(
521
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => data is T,
522
+ options?: ArrayOptions,
523
+ ): Promise<T | undefined>;
524
+ find(
525
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,
526
+ options?: ArrayOptions,
527
+ ): Promise<any>;
528
+ /**
529
+ * This method is similar to `Array.prototype.every` and calls *fn* on each chunk in the stream
530
+ * to check if all awaited return values are truthy value for *fn*. Once an *fn* call on a chunk
531
+ * `await`ed return value is falsy, the stream is destroyed and the promise is fulfilled with `false`.
532
+ * If all of the *fn* calls on the chunks return a truthy value, the promise is fulfilled with `true`.
533
+ * @since v17.5.0
534
+ * @param fn a function to call on each chunk of the stream. Async or not.
535
+ * @returns a promise evaluating to `true` if *fn* returned a truthy value for every one of the chunks.
536
+ */
537
+ every(
538
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,
539
+ options?: ArrayOptions,
540
+ ): Promise<boolean>;
541
+ /**
542
+ * This method returns a new stream by applying the given callback to each chunk of the stream
543
+ * and then flattening the result.
544
+ *
545
+ * It is possible to return a stream or another iterable or async iterable from *fn* and the result streams
546
+ * will be merged (flattened) into the returned stream.
547
+ * @since v17.5.0
548
+ * @param fn a function to map over every chunk in the stream. May be async. May be a stream or generator.
549
+ * @returns a stream flat-mapped with the function *fn*.
550
+ */
551
+ flatMap(fn: (data: any, options?: Pick<ArrayOptions, "signal">) => any, options?: ArrayOptions): Readable;
552
+ /**
553
+ * This method returns a new stream with the first *limit* chunks dropped from the start.
554
+ * @since v17.5.0
555
+ * @param limit the number of chunks to drop from the readable.
556
+ * @returns a stream with *limit* chunks dropped from the start.
557
+ */
558
+ drop(limit: number, options?: Pick<ArrayOptions, "signal">): Readable;
559
+ /**
560
+ * This method returns a new stream with the first *limit* chunks.
561
+ * @since v17.5.0
562
+ * @param limit the number of chunks to take from the readable.
563
+ * @returns a stream with *limit* chunks taken.
564
+ */
565
+ take(limit: number, options?: Pick<ArrayOptions, "signal">): Readable;
566
+ /**
567
+ * This method returns a new stream with chunks of the underlying stream paired with a counter
568
+ * in the form `[index, chunk]`. The first index value is `0` and it increases by 1 for each chunk produced.
569
+ * @since v17.5.0
570
+ * @returns a stream of indexed pairs.
571
+ */
572
+ asIndexedPairs(options?: Pick<ArrayOptions, "signal">): Readable;
573
+ /**
574
+ * This method calls *fn* on each chunk of the stream in order, passing it the result from the calculation
575
+ * on the previous element. It returns a promise for the final value of the reduction.
576
+ *
577
+ * If no *initial* value is supplied the first chunk of the stream is used as the initial value.
578
+ * If the stream is empty, the promise is rejected with a `TypeError` with the `ERR_INVALID_ARGS` code property.
579
+ *
580
+ * The reducer function iterates the stream element-by-element which means that there is no *concurrency* parameter
581
+ * or parallelism. To perform a reduce concurrently, you can extract the async function to `readable.map` method.
582
+ * @since v17.5.0
583
+ * @param fn a reducer function to call over every chunk in the stream. Async or not.
584
+ * @param initial the initial value to use in the reduction.
585
+ * @returns a promise for the final value of the reduction.
586
+ */
587
+ reduce<T = any>(
588
+ fn: (previous: any, data: any, options?: Pick<ArrayOptions, "signal">) => T,
589
+ initial?: undefined,
590
+ options?: Pick<ArrayOptions, "signal">,
591
+ ): Promise<T>;
592
+ reduce<T = any>(
593
+ fn: (previous: T, data: any, options?: Pick<ArrayOptions, "signal">) => T,
594
+ initial: T,
595
+ options?: Pick<ArrayOptions, "signal">,
596
+ ): Promise<T>;
433
597
  _destroy(error: Error | null, callback: (error?: Error | null) => void): void;
434
598
  /**
435
599
  * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'`event (unless `emitClose` is set to `false`). After this call, the readable
@@ -511,6 +675,11 @@ declare module "stream" {
511
675
  removeListener(event: "resume", listener: () => void): this;
512
676
  removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
513
677
  [Symbol.asyncIterator](): AsyncIterableIterator<any>;
678
+ /**
679
+ * Calls `readable.destroy()` with an `AbortError` and returns a promise that fulfills when the stream is finished.
680
+ * @since v18.18.0
681
+ */
682
+ [Symbol.asyncDispose](): Promise<void>;
514
683
  }
515
684
  interface WritableOptions extends StreamOptions<Writable> {
516
685
  decodeStrings?: boolean | undefined;
@@ -3,6 +3,7 @@
3
3
  * @see [source](https://github.com/nodejs/node/blob/v18.x/lib/test.js)
4
4
  */
5
5
  declare module "node:test" {
6
+ import { AsyncResource } from "node:async_hooks";
6
7
  /**
7
8
  * Programmatically start the test runner.
8
9
  * @since v18.9.0
@@ -58,31 +59,33 @@ declare module "node:test" {
58
59
  * @param options Configuration options for the suite
59
60
  * @param fn The function under suite. Default: A no-op function.
60
61
  */
61
- function describe(name?: string, options?: TestOptions, fn?: SuiteFn): void;
62
- function describe(name?: string, fn?: SuiteFn): void;
63
- function describe(options?: TestOptions, fn?: SuiteFn): void;
64
- function describe(fn?: SuiteFn): void;
62
+ function describe(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
63
+ function describe(name?: string, fn?: SuiteFn): Promise<void>;
64
+ function describe(options?: TestOptions, fn?: SuiteFn): Promise<void>;
65
+ function describe(fn?: SuiteFn): Promise<void>;
65
66
  namespace describe {
66
- // Shorthand for skipping a suite, same as `describe([name], { skip: true }[, fn])`.
67
- function skip(name?: string, options?: TestOptions, fn?: SuiteFn): void;
68
- function skip(name?: string, fn?: SuiteFn): void;
69
- function skip(options?: TestOptions, fn?: SuiteFn): void;
70
- function skip(fn?: SuiteFn): void;
71
-
72
- // Shorthand for marking a suite as `TODO`, same as `describe([name], { todo: true }[, fn])`.
73
- function todo(name?: string, options?: TestOptions, fn?: SuiteFn): void;
74
- function todo(name?: string, fn?: SuiteFn): void;
75
- function todo(options?: TestOptions, fn?: SuiteFn): void;
76
- function todo(fn?: SuiteFn): void;
77
-
67
+ /**
68
+ * Shorthand for skipping a suite, same as `describe([name], { skip: true }[, fn])`.
69
+ */
70
+ function skip(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
71
+ function skip(name?: string, fn?: SuiteFn): Promise<void>;
72
+ function skip(options?: TestOptions, fn?: SuiteFn): Promise<void>;
73
+ function skip(fn?: SuiteFn): Promise<void>;
74
+ /**
75
+ * Shorthand for marking a suite as `TODO`, same as `describe([name], { todo: true }[, fn])`.
76
+ */
77
+ function todo(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
78
+ function todo(name?: string, fn?: SuiteFn): Promise<void>;
79
+ function todo(options?: TestOptions, fn?: SuiteFn): Promise<void>;
80
+ function todo(fn?: SuiteFn): Promise<void>;
78
81
  /**
79
82
  * Shorthand for marking a suite as `only`, same as `describe([name], { only: true }[, fn])`.
80
83
  * @since v18.15.0
81
84
  */
82
- function only(name?: string, options?: TestOptions, fn?: SuiteFn): void;
83
- function only(name?: string, fn?: SuiteFn): void;
84
- function only(options?: TestOptions, fn?: SuiteFn): void;
85
- function only(fn?: SuiteFn): void;
85
+ function only(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
86
+ function only(name?: string, fn?: SuiteFn): Promise<void>;
87
+ function only(options?: TestOptions, fn?: SuiteFn): Promise<void>;
88
+ function only(fn?: SuiteFn): Promise<void>;
86
89
  }
87
90
 
88
91
  /**
@@ -93,31 +96,33 @@ declare module "node:test" {
93
96
  * @param fn The function under test. If the test uses callbacks, the callback function is
94
97
  * passed as the second argument. Default: A no-op function.
95
98
  */
96
- function it(name?: string, options?: TestOptions, fn?: TestFn): void;
97
- function it(name?: string, fn?: TestFn): void;
98
- function it(options?: TestOptions, fn?: TestFn): void;
99
- function it(fn?: TestFn): void;
99
+ function it(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
100
+ function it(name?: string, fn?: TestFn): Promise<void>;
101
+ function it(options?: TestOptions, fn?: TestFn): Promise<void>;
102
+ function it(fn?: TestFn): Promise<void>;
100
103
  namespace it {
101
- // Shorthand for skipping a test, same as `it([name], { skip: true }[, fn])`.
102
- function skip(name?: string, options?: TestOptions, fn?: TestFn): void;
103
- function skip(name?: string, fn?: TestFn): void;
104
- function skip(options?: TestOptions, fn?: TestFn): void;
105
- function skip(fn?: TestFn): void;
106
-
107
- // Shorthand for marking a test as `TODO`, same as `it([name], { todo: true }[, fn])`.
108
- function todo(name?: string, options?: TestOptions, fn?: TestFn): void;
109
- function todo(name?: string, fn?: TestFn): void;
110
- function todo(options?: TestOptions, fn?: TestFn): void;
111
- function todo(fn?: TestFn): void;
112
-
104
+ /**
105
+ * Shorthand for skipping a test, same as `it([name], { skip: true }[, fn])`.
106
+ */
107
+ function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
108
+ function skip(name?: string, fn?: TestFn): Promise<void>;
109
+ function skip(options?: TestOptions, fn?: TestFn): Promise<void>;
110
+ function skip(fn?: TestFn): Promise<void>;
111
+ /**
112
+ * Shorthand for marking a test as `TODO`, same as `it([name], { todo: true }[, fn])`.
113
+ */
114
+ function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
115
+ function todo(name?: string, fn?: TestFn): Promise<void>;
116
+ function todo(options?: TestOptions, fn?: TestFn): Promise<void>;
117
+ function todo(fn?: TestFn): Promise<void>;
113
118
  /**
114
119
  * Shorthand for marking a test as `only`, same as `it([name], { only: true }[, fn])`.
115
120
  * @since v18.15.0
116
121
  */
117
- function only(name?: string, options?: TestOptions, fn?: TestFn): void;
118
- function only(name?: string, fn?: TestFn): void;
119
- function only(options?: TestOptions, fn?: TestFn): void;
120
- function only(fn?: TestFn): void;
122
+ function only(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
123
+ function only(name?: string, fn?: TestFn): Promise<void>;
124
+ function only(options?: TestOptions, fn?: TestFn): Promise<void>;
125
+ function only(fn?: TestFn): Promise<void>;
121
126
  }
122
127
  /**
123
128
  * Shorthand for skipping a test, same as `test([name], { skip: true }[, fn])`.
@@ -191,6 +196,30 @@ declare module "node:test" {
191
196
  * incremented from the primary's `process.debugPort`.
192
197
  */
193
198
  inspectPort?: number | (() => number) | undefined;
199
+ /**
200
+ * That can be used to only run tests whose name matches the provided pattern.
201
+ * Test name patterns are interpreted as JavaScript regular expressions.
202
+ * For each test that is executed, any corresponding test hooks, such as `beforeEach()`, are also run.
203
+ */
204
+ testNamePatterns?: string | RegExp | string[] | RegExp[];
205
+ /**
206
+ * A function that accepts the TestsStream instance and can be used to setup listeners before any tests are run.
207
+ */
208
+ setup?: (root: Test) => void | Promise<void>;
209
+ /**
210
+ * Whether to run in watch mode or not.
211
+ * @default false
212
+ */
213
+ watch?: boolean | undefined;
214
+ }
215
+ class Test extends AsyncResource {
216
+ concurrency: number;
217
+ nesting: number;
218
+ only: boolean;
219
+ reporter: TestsStream;
220
+ runOnlySubtests: boolean;
221
+ testNumber: number;
222
+ timeout: number | null;
194
223
  }
195
224
 
196
225
  /**
@@ -44,6 +44,11 @@ declare module "timers" {
44
44
  */
45
45
  hasRef(): boolean;
46
46
  _onImmediate: Function; // to distinguish it from the Timeout class
47
+ /**
48
+ * Cancels the immediate. This is similar to calling `clearImmediate()`.
49
+ * @since v18.18.0
50
+ */
51
+ [Symbol.dispose](): void;
47
52
  }
48
53
  interface Timeout extends Timer {
49
54
  /**
@@ -64,8 +69,20 @@ declare module "timers" {
64
69
  */
65
70
  refresh(): this;
66
71
  [Symbol.toPrimitive](): number;
72
+ /**
73
+ * Cancels the timeout.
74
+ * @since v18.18.0
75
+ */
76
+ [Symbol.dispose](): void;
67
77
  }
68
78
  }
79
+ /**
80
+ * Schedules execution of a one-time `callback` after `delay` milliseconds. The `callback` will likely not be invoked in precisely `delay` milliseconds.
81
+ * Node.js makes no guarantees about the exact timing of when callbacks will fire, nor of their ordering. The callback will be called as close as possible to the time specified.
82
+ * When `delay` is larger than `2147483647` or less than `1`, the `delay` will be set to `1`. Non-integer delays are truncated to an integer.
83
+ * If `callback` is not a function, a [TypeError](https://nodejs.org/api/errors.html#class-typeerror) will be thrown.
84
+ * @since v0.0.1
85
+ */
69
86
  function setTimeout<TArgs extends any[]>(
70
87
  callback: (...args: TArgs) => void,
71
88
  ms?: number,
@@ -82,10 +99,10 @@ declare module "timers" {
82
99
  callback: (...args: TArgs) => void,
83
100
  ms?: number,
84
101
  ...args: TArgs
85
- ): NodeJS.Timer;
102
+ ): NodeJS.Timeout;
86
103
  // util.promisify no rest args compability
87
104
  // tslint:disable-next-line void-return
88
- function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timer;
105
+ function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timeout;
89
106
  namespace setInterval {
90
107
  const __promisify__: typeof setIntervalPromise;
91
108
  }
@@ -783,9 +783,12 @@ declare module "url" {
783
783
  */
784
784
  append(name: string, value: string): void;
785
785
  /**
786
- * Remove all name-value pairs whose name is `name`.
786
+ * If `value` is provided, removes all name-value pairs
787
+ * where name is `name` and value is `value`..
788
+ *
789
+ * If `value` is not provided, removes all name-value pairs whose name is `name`.
787
790
  */
788
- delete(name: string): void;
791
+ delete(name: string, value?: string): void;
789
792
  /**
790
793
  * Returns an ES6 `Iterator` over each of the name-value pairs in the query.
791
794
  * Each item of the iterator is a JavaScript `Array`. The first item of the `Array`is the `name`, the second item of the `Array` is the `value`.
@@ -824,9 +827,15 @@ declare module "url" {
824
827
  */
825
828
  getAll(name: string): string[];
826
829
  /**
827
- * Returns `true` if there is at least one name-value pair whose name is `name`.
830
+ * Checks if the `URLSearchParams` object contains key-value pair(s) based on`name` and an optional `value` argument.
831
+ *
832
+ * If `value` is provided, returns `true` when name-value pair with
833
+ * same `name` and `value` exists.
834
+ *
835
+ * If `value` is not provided, returns `true` if there is at least one name-value
836
+ * pair whose name is `name`.
828
837
  */
829
- has(name: string): boolean;
838
+ has(name: string, value?: string): boolean;
830
839
  /**
831
840
  * Returns an ES6 `Iterator` over the names of each name-value pair.
832
841
  *
@@ -783,9 +783,12 @@ declare module "url" {
783
783
  */
784
784
  append(name: string, value: string): void;
785
785
  /**
786
- * Remove all name-value pairs whose name is `name`.
786
+ * If `value` is provided, removes all name-value pairs
787
+ * where name is `name` and value is `value`..
788
+ *
789
+ * If `value` is not provided, removes all name-value pairs whose name is `name`.
787
790
  */
788
- delete(name: string): void;
791
+ delete(name: string, value?: string): void;
789
792
  /**
790
793
  * Returns an ES6 `Iterator` over each of the name-value pairs in the query.
791
794
  * Each item of the iterator is a JavaScript `Array`. The first item of the `Array`is the `name`, the second item of the `Array` is the `value`.
@@ -824,9 +827,15 @@ declare module "url" {
824
827
  */
825
828
  getAll(name: string): string[];
826
829
  /**
827
- * Returns `true` if there is at least one name-value pair whose name is `name`.
830
+ * Checks if the `URLSearchParams` object contains key-value pair(s) based on`name` and an optional `value` argument.
831
+ *
832
+ * If `value` is provided, returns `true` when name-value pair with
833
+ * same `name` and `value` exists.
834
+ *
835
+ * If `value` is not provided, returns `true` if there is at least one name-value
836
+ * pair whose name is `name`.
828
837
  */
829
- has(name: string): boolean;
838
+ has(name: string, value?: string): boolean;
830
839
  /**
831
840
  * Returns an ES6 `Iterator` over the names of each name-value pair.
832
841
  *
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes