Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion types/node/test.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@
*
* If any tests fail, the process exit code is set to `1`.
* @since v18.0.0, v16.17.0
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/test.js)
* @see [source](https://github.com/nodejs/node/blob/v20.4.0/lib/test.js)
*/
declare module 'node:test' {
import { Readable } from 'node:stream';
import { AsyncResource } from 'node:async_hooks';
/**
* ```js
* import { tap } from 'node:test/reporters';
Expand Down Expand Up @@ -295,6 +296,23 @@ declare module 'node:test' {
* For each test that is executed, any corresponding test hooks, such as `beforeEach()`, are also run.
*/
testNamePatterns?: string | RegExp | string[] | RegExp[];
/**
* A function that accepts the TestsStream instance and can be used to setup listeners before any tests are run.
*/
setup?: (root: Test) => void | Promise<void>;
/**
* Whether to run in watch mode or not. Default: false.
*/
watch?: boolean;
}
class Test extends AsyncResource {
concurrency: number;
nesting: number;
only: boolean;
reporter: TestsStream;
runOnlySubtests: boolean;
testNumber: number;
timeout: number | null;
}
/**
* 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
Expand Down
2 changes: 2 additions & 0 deletions types/node/test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ run({
timeout: 100,
inspectPort: () => 8081,
testNamePatterns: ['executed'],
setup: (root) => {},
watch: true
});

// TestsStream should be a NodeJS.ReadableStream
Expand Down
18 changes: 18 additions & 0 deletions types/node/ts4.8/test.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
*/
declare module 'node:test' {
import { Readable } from 'node:stream';
import { AsyncResource } from 'node:async_hooks';
/**
* ```js
* import { tap } from 'node:test/reporters';
Expand Down Expand Up @@ -295,6 +296,23 @@ declare module 'node:test' {
* For each test that is executed, any corresponding test hooks, such as `beforeEach()`, are also run.
*/
testNamePatterns?: string | RegExp | string[] | RegExp[];
/**
* A function that accepts the TestsStream instance and can be used to setup listeners before any tests are run.
*/
setup?: (root: unknown) => void | Promise<void>;
/**
* Whether to run in watch mode or not. Default: false.
*/
watch?: boolean;
}
class Test extends AsyncResource {
concurrency: number;
nesting: number;
only: boolean;
reporter: TestsStream;
runOnlySubtests: boolean;
testNumber: number;
timeout: number | null;
}
/**
* 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
Expand Down
2 changes: 2 additions & 0 deletions types/node/ts4.8/test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ run({
timeout: 100,
inspectPort: () => 8081,
testNamePatterns: ['executed'],
setup: (root) => {},
watch: true
});

// TestsStream should be a NodeJS.ReadableStream
Expand Down
14 changes: 14 additions & 0 deletions types/node/v18/test.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* @see [source](https://github.com/nodejs/node/blob/v18.x/lib/test.js)
*/
declare module 'node:test' {
import { AsyncResource } from 'node:async_hooks';
/**
* Programmatically start the test runner.
* @since v18.9.0
Expand Down Expand Up @@ -178,6 +179,19 @@ declare module 'node:test' {
* incremented from the primary's `process.debugPort`.
*/
inspectPort?: number | (() => number) | undefined;
/**
* A function that accepts the TestsStream instance and can be used to setup listeners before any tests are run.
*/
setup?: (root: Test) => void | Promise<void>;
}
class Test extends AsyncResource {
concurrency: number;
nesting: number;
only: boolean;
reporter: TestsStream;
runOnlySubtests: boolean;
testNumber: number;
timeout: number | null;
}

/**
Expand Down
1 change: 1 addition & 0 deletions types/node/v18/test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ run({
signal: new AbortController().signal,
timeout: 100,
inspectPort: () => 8081,
setup: (root) => {},
});

// TestsStream should be a NodeJS.ReadableStream
Expand Down