@types/node 22.4.0 → 22.4.1

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/process.d.ts +20 -15
  4. node/test.d.ts +24 -8
node/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (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: Fri, 16 Aug 2024 18:09:07 GMT
11
+ * Last updated: Mon, 19 Aug 2024 02:45:10 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "22.4.0",
3
+ "version": "22.4.1",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -212,6 +212,6 @@
212
212
  "dependencies": {
213
213
  "undici-types": "~6.19.2"
214
214
  },
215
- "typesPublisherContentHash": "f22f2e87b11a05781ab2a2c4b7812aa834cf70e01e9db42c5288e6cc3f15fd47",
215
+ "typesPublisherContentHash": "ccc9f99822466307487be499b4c3c04a1a5f42f97b354a1afa5584dfa95e982d",
216
216
  "typeScriptVersion": "4.8"
217
217
  }
node/process.d.ts CHANGED
@@ -322,24 +322,28 @@ declare module "process" {
322
322
  has(scope: string, reference?: string): boolean;
323
323
  }
324
324
  interface ProcessReport {
325
+ /**
326
+ * Write reports in a compact format, single-line JSON, more easily consumable by log processing systems
327
+ * than the default multi-line format designed for human consumption.
328
+ * @since v13.12.0, v12.17.0
329
+ */
330
+ compact: boolean;
325
331
  /**
326
332
  * Directory where the report is written.
333
+ * The default value is the empty string, indicating that reports are written to the current
327
334
  * working directory of the Node.js process.
328
- * @default '' indicating that reports are written to the current
329
335
  */
330
336
  directory: string;
331
337
  /**
332
- * Filename where the report is written.
333
- * The default value is the empty string.
334
- * @default '' the output filename will be comprised of a timestamp,
335
- * PID, and sequence number.
338
+ * Filename where the report is written. If set to the empty string, the output filename will be comprised
339
+ * of a timestamp, PID, and sequence number. The default value is the empty string.
336
340
  */
337
341
  filename: string;
338
342
  /**
339
- * Returns a JSON-formatted diagnostic report for the running process.
340
- * The report's JavaScript stack trace is taken from err, if present.
343
+ * Returns a JavaScript Object representation of a diagnostic report for the running process.
344
+ * The report's JavaScript stack trace is taken from `err`, if present.
341
345
  */
342
- getReport(err?: Error): string;
346
+ getReport(err?: Error): object;
343
347
  /**
344
348
  * If true, a diagnostic report is generated on fatal errors,
345
349
  * such as out of memory errors or failed C++ assertions.
@@ -365,18 +369,19 @@ declare module "process" {
365
369
  /**
366
370
  * Writes a diagnostic report to a file. If filename is not provided, the default filename
367
371
  * includes the date, time, PID, and a sequence number.
368
- * The report's JavaScript stack trace is taken from err, if present.
372
+ * The report's JavaScript stack trace is taken from `err`, if present.
369
373
  *
374
+ * If the value of filename is set to `'stdout'` or `'stderr'`, the report is written
375
+ * to the stdout or stderr of the process respectively.
370
376
  * @param fileName Name of the file where the report is written.
371
377
  * This should be a relative path, that will be appended to the directory specified in
372
378
  * `process.report.directory`, or the current working directory of the Node.js process,
373
379
  * if unspecified.
374
- * @param error A custom error used for reporting the JavaScript stack.
380
+ * @param err A custom error used for reporting the JavaScript stack.
375
381
  * @return Filename of the generated report.
376
382
  */
377
- writeReport(fileName?: string): string;
378
- writeReport(error?: Error): string;
379
383
  writeReport(fileName?: string, err?: Error): string;
384
+ writeReport(err?: Error): string;
380
385
  }
381
386
  interface ResourceUsage {
382
387
  fsRead: number;
@@ -1704,11 +1709,11 @@ declare module "process" {
1704
1709
  */
1705
1710
  allowedNodeEnvironmentFlags: ReadonlySet<string>;
1706
1711
  /**
1707
- * `process.report` is an object whose methods are used to generate diagnostic
1708
- * reports for the current process. Additional documentation is available in the `report documentation`.
1712
+ * `process.report` is an object whose methods are used to generate diagnostic reports for the current process.
1713
+ * Additional documentation is available in the [report documentation](https://nodejs.org/docs/latest-v22.x/api/report.html).
1709
1714
  * @since v11.8.0
1710
1715
  */
1711
- report?: ProcessReport | undefined;
1716
+ report: ProcessReport;
1712
1717
  /**
1713
1718
  * ```js
1714
1719
  * import { resourceUsage } from 'node:process';
node/test.d.ts CHANGED
@@ -1960,31 +1960,47 @@ declare module "node:test/reporters" {
1960
1960
  | { type: "test:watch:drained"; data: undefined };
1961
1961
  type TestEventGenerator = AsyncGenerator<TestEvent, void>;
1962
1962
 
1963
+ interface ReporterConstructorWrapper<T extends new(...args: any[]) => Transform> {
1964
+ new(...args: ConstructorParameters<T>): InstanceType<T>;
1965
+ (...args: ConstructorParameters<T>): InstanceType<T>;
1966
+ }
1967
+
1963
1968
  /**
1964
1969
  * The `dot` reporter outputs the test results in a compact format,
1965
1970
  * where each passing test is represented by a `.`,
1966
1971
  * and each failing test is represented by a `X`.
1972
+ * @since v20.0.0
1967
1973
  */
1968
1974
  function dot(source: TestEventGenerator): AsyncGenerator<"\n" | "." | "X", void>;
1969
1975
  /**
1970
1976
  * The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format.
1977
+ * @since v20.0.0
1971
1978
  */
1972
1979
  function tap(source: TestEventGenerator): AsyncGenerator<string, void>;
1980
+ class SpecReporter extends Transform {
1981
+ constructor();
1982
+ }
1973
1983
  /**
1974
1984
  * The `spec` reporter outputs the test results in a human-readable format.
1985
+ * @since v20.0.0
1975
1986
  */
1976
- class Spec extends Transform {
1977
- constructor();
1978
- }
1987
+ const spec: ReporterConstructorWrapper<typeof SpecReporter>;
1979
1988
  /**
1980
1989
  * The `junit` reporter outputs test results in a jUnit XML format.
1990
+ * @since v21.0.0
1981
1991
  */
1982
1992
  function junit(source: TestEventGenerator): AsyncGenerator<string, void>;
1993
+ class LcovReporter extends Transform {
1994
+ constructor(opts?: Omit<TransformOptions, "writableObjectMode">);
1995
+ }
1983
1996
  /**
1984
- * The `lcov` reporter outputs test coverage when used with the [`--experimental-test-coverage`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--experimental-test-coverage) flag.
1997
+ * The `lcov` reporter outputs test coverage when used with the
1998
+ * [`--experimental-test-coverage`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--experimental-test-coverage) flag.
1999
+ * @since v22.0.0
1985
2000
  */
1986
- class Lcov extends Transform {
1987
- constructor(opts?: TransformOptions);
1988
- }
1989
- export { dot, junit, Lcov as lcov, Spec as spec, tap, TestEvent };
2001
+ // TODO: change the export to a wrapper function once node@0db38f0 is merged (breaking change)
2002
+ // const lcov: ReporterConstructorWrapper<typeof LcovReporter>;
2003
+ const lcov: LcovReporter;
2004
+
2005
+ export { dot, junit, lcov, spec, tap, TestEvent };
1990
2006
  }