@types/node 20.4.0 → 20.4.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.
Files changed (5) hide show
  1. node/README.md +1 -1
  2. node/net.d.ts +1 -1
  3. node/package.json +2 -2
  4. node/test.d.ts +64 -46
  5. node/ts4.8/net.d.ts +1 -1
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, 05 Jul 2023 21:32:40 GMT
11
+ * Last updated: Wed, 12 Jul 2023 23:02:41 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
14
14
 
node/net.d.ts CHANGED
@@ -16,7 +16,7 @@ declare module 'net' {
16
16
  import * as stream from 'node:stream';
17
17
  import { Abortable, EventEmitter } from 'node:events';
18
18
  import * as dns from 'node:dns';
19
- type LookupFunction = (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void;
19
+ type LookupFunction = (hostname: string, options: dns.LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: dns.LookupAddress[]) => void) => void;
20
20
  interface AddressInfo {
21
21
  address: string;
22
22
  family: string;
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "20.4.0",
3
+ "version": "20.4.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": "c342b7a9708bb206f3dfc674c1d142bfdaf5a01b59dc5d8bd88d18fc226c2de3",
235
+ "typesPublisherContentHash": "8ccebbf79ef4c9ade9cde2b505492190d140170bf4372bb3fe1ebd36e9344eac",
236
236
  "typeScriptVersion": "4.3"
237
237
  }
node/test.d.ts CHANGED
@@ -161,33 +161,33 @@ declare module 'node:test' {
161
161
  * @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.
162
162
  * @return Immediately fulfilled with `undefined`.
163
163
  */
164
- function describe(name?: string, options?: TestOptions, fn?: SuiteFn): void;
165
- function describe(name?: string, fn?: SuiteFn): void;
166
- function describe(options?: TestOptions, fn?: SuiteFn): void;
167
- function describe(fn?: SuiteFn): void;
164
+ function describe(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
165
+ function describe(name?: string, fn?: SuiteFn): Promise<void>;
166
+ function describe(options?: TestOptions, fn?: SuiteFn): Promise<void>;
167
+ function describe(fn?: SuiteFn): Promise<void>;
168
168
  namespace describe {
169
169
  /**
170
170
  * Shorthand for skipping a suite, same as `describe([name], { skip: true }[, fn])`.
171
171
  */
172
- function skip(name?: string, options?: TestOptions, fn?: SuiteFn): void;
173
- function skip(name?: string, fn?: SuiteFn): void;
174
- function skip(options?: TestOptions, fn?: SuiteFn): void;
175
- function skip(fn?: SuiteFn): void;
172
+ function skip(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
173
+ function skip(name?: string, fn?: SuiteFn): Promise<void>;
174
+ function skip(options?: TestOptions, fn?: SuiteFn): Promise<void>;
175
+ function skip(fn?: SuiteFn): Promise<void>;
176
176
  /**
177
177
  * Shorthand for marking a suite as `TODO`, same as `describe([name], { todo: true }[, fn])`.
178
178
  */
179
- function todo(name?: string, options?: TestOptions, fn?: SuiteFn): void;
180
- function todo(name?: string, fn?: SuiteFn): void;
181
- function todo(options?: TestOptions, fn?: SuiteFn): void;
182
- function todo(fn?: SuiteFn): void;
179
+ function todo(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
180
+ function todo(name?: string, fn?: SuiteFn): Promise<void>;
181
+ function todo(options?: TestOptions, fn?: SuiteFn): Promise<void>;
182
+ function todo(fn?: SuiteFn): Promise<void>;
183
183
  /**
184
184
  * Shorthand for marking a suite as `only`, same as `describe([name], { only: true }[, fn])`.
185
185
  * @since v18.15.0
186
186
  */
187
- function only(name?: string, options?: TestOptions, fn?: SuiteFn): void;
188
- function only(name?: string, fn?: SuiteFn): void;
189
- function only(options?: TestOptions, fn?: SuiteFn): void;
190
- function only(fn?: SuiteFn): void;
187
+ function only(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
188
+ function only(name?: string, fn?: SuiteFn): Promise<void>;
189
+ function only(options?: TestOptions, fn?: SuiteFn): Promise<void>;
190
+ function only(fn?: SuiteFn): Promise<void>;
191
191
  }
192
192
  /**
193
193
  * Shorthand for `test()`.
@@ -195,69 +195,69 @@ declare module 'node:test' {
195
195
  * The `it()` function is imported from the `node:test` module.
196
196
  * @since v18.6.0, v16.17.0
197
197
  */
198
- function it(name?: string, options?: TestOptions, fn?: TestFn): void;
199
- function it(name?: string, fn?: TestFn): void;
200
- function it(options?: TestOptions, fn?: TestFn): void;
201
- function it(fn?: TestFn): void;
198
+ function it(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
199
+ function it(name?: string, fn?: TestFn): Promise<void>;
200
+ function it(options?: TestOptions, fn?: TestFn): Promise<void>;
201
+ function it(fn?: TestFn): Promise<void>;
202
202
  namespace it {
203
203
  /**
204
204
  * Shorthand for skipping a test, same as `it([name], { skip: true }[, fn])`.
205
205
  */
206
- function skip(name?: string, options?: TestOptions, fn?: TestFn): void;
207
- function skip(name?: string, fn?: TestFn): void;
208
- function skip(options?: TestOptions, fn?: TestFn): void;
209
- function skip(fn?: TestFn): void;
206
+ function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
207
+ function skip(name?: string, fn?: TestFn): Promise<void>;
208
+ function skip(options?: TestOptions, fn?: TestFn): Promise<void>;
209
+ function skip(fn?: TestFn): Promise<void>;
210
210
  /**
211
211
  * Shorthand for marking a test as `TODO`, same as `it([name], { todo: true }[, fn])`.
212
212
  */
213
- function todo(name?: string, options?: TestOptions, fn?: TestFn): void;
214
- function todo(name?: string, fn?: TestFn): void;
215
- function todo(options?: TestOptions, fn?: TestFn): void;
216
- function todo(fn?: TestFn): void;
213
+ function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
214
+ function todo(name?: string, fn?: TestFn): Promise<void>;
215
+ function todo(options?: TestOptions, fn?: TestFn): Promise<void>;
216
+ function todo(fn?: TestFn): Promise<void>;
217
217
  /**
218
218
  * Shorthand for marking a test as `only`, same as `it([name], { only: true }[, fn])`.
219
219
  * @since v18.15.0
220
220
  */
221
- function only(name?: string, options?: TestOptions, fn?: TestFn): void;
222
- function only(name?: string, fn?: TestFn): void;
223
- function only(options?: TestOptions, fn?: TestFn): void;
224
- function only(fn?: TestFn): void;
221
+ function only(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
222
+ function only(name?: string, fn?: TestFn): Promise<void>;
223
+ function only(options?: TestOptions, fn?: TestFn): Promise<void>;
224
+ function only(fn?: TestFn): Promise<void>;
225
225
  }
226
226
  /**
227
227
  * Shorthand for skipping a test, same as `test([name], { skip: true }[, fn])`.
228
228
  * @since v20.2.0
229
229
  */
230
- function skip(name?: string, options?: TestOptions, fn?: TestFn): void;
231
- function skip(name?: string, fn?: TestFn): void;
232
- function skip(options?: TestOptions, fn?: TestFn): void;
233
- function skip(fn?: TestFn): void;
230
+ function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
231
+ function skip(name?: string, fn?: TestFn): Promise<void>;
232
+ function skip(options?: TestOptions, fn?: TestFn): Promise<void>;
233
+ function skip(fn?: TestFn): Promise<void>;
234
234
  /**
235
235
  * Shorthand for marking a test as `TODO`, same as `test([name], { todo: true }[, fn])`.
236
236
  * @since v20.2.0
237
237
  */
238
- function todo(name?: string, options?: TestOptions, fn?: TestFn): void;
239
- function todo(name?: string, fn?: TestFn): void;
240
- function todo(options?: TestOptions, fn?: TestFn): void;
241
- function todo(fn?: TestFn): void;
238
+ function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
239
+ function todo(name?: string, fn?: TestFn): Promise<void>;
240
+ function todo(options?: TestOptions, fn?: TestFn): Promise<void>;
241
+ function todo(fn?: TestFn): Promise<void>;
242
242
  /**
243
243
  * Shorthand for marking a test as `only`, same as `test([name], { only: true }[, fn])`.
244
244
  * @since v20.2.0
245
245
  */
246
- function only(name?: string, options?: TestOptions, fn?: TestFn): void;
247
- function only(name?: string, fn?: TestFn): void;
248
- function only(options?: TestOptions, fn?: TestFn): void;
249
- function only(fn?: TestFn): void;
246
+ function only(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
247
+ function only(name?: string, fn?: TestFn): Promise<void>;
248
+ function only(options?: TestOptions, fn?: TestFn): Promise<void>;
249
+ function only(fn?: TestFn): Promise<void>;
250
250
  /**
251
251
  * The type of a function under test. The first argument to this function is a
252
252
  * {@link TestContext} object. If the test uses callbacks, the callback function is passed as
253
253
  * the second argument.
254
254
  */
255
- type TestFn = (t: TestContext, done: (result?: any) => void) => any;
255
+ type TestFn = (t: TestContext, done: (result?: any) => void) => void | Promise<void>;
256
256
  /**
257
257
  * The type of a function under Suite.
258
258
  * If the test uses callbacks, the callback function is passed as an argument
259
259
  */
260
- type SuiteFn = (done: (result?: any) => void) => void;
260
+ type SuiteFn = (s: SuiteContext) => void | Promise<void>;
261
261
  interface RunOptions {
262
262
  /**
263
263
  * If a number is provided, then that many files would run in parallel.
@@ -486,6 +486,24 @@ declare module 'node:test' {
486
486
  */
487
487
  readonly mock: MockTracker;
488
488
  }
489
+ /**
490
+ * An instance of `SuiteContext` is passed to each suite function in order to
491
+ * interact with the test runner. However, the `SuiteContext` constructor is not
492
+ * exposed as part of the API.
493
+ * @since v18.7.0, v16.17.0
494
+ */
495
+ class SuiteContext {
496
+ /**
497
+ * The name of the suite.
498
+ * @since v18.8.0, v16.18.0
499
+ */
500
+ readonly name: string;
501
+ /**
502
+ * Can be used to abort test subtasks when the test has been aborted.
503
+ * @since v18.7.0, v16.17.0
504
+ */
505
+ readonly signal: AbortSignal;
506
+ }
489
507
  interface TestOptions {
490
508
  /**
491
509
  * If a number is provided, then that many tests would run in parallel.
node/ts4.8/net.d.ts CHANGED
@@ -16,7 +16,7 @@ declare module 'net' {
16
16
  import * as stream from 'node:stream';
17
17
  import { Abortable, EventEmitter } from 'node:events';
18
18
  import * as dns from 'node:dns';
19
- type LookupFunction = (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void;
19
+ type LookupFunction = (hostname: string, options: dns.LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: dns.LookupAddress[]) => void) => void;
20
20
  interface AddressInfo {
21
21
  address: string;
22
22
  family: string;