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
2 changes: 1 addition & 1 deletion types/node/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Type definitions for non-npm package Node.js 20.1
// Type definitions for non-npm package Node.js 20.2
// Project: https://nodejs.org/
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
// DefinitelyTyped <https://github.com/DefinitelyTyped>
Expand Down
37 changes: 37 additions & 0 deletions types/node/test.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,29 @@ declare module 'node:test' {
function test(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
function test(options?: TestOptions, fn?: TestFn): Promise<void>;
function test(fn?: TestFn): Promise<void>;
namespace test {
/**
* Shorthand for skipping a suite, same as `test([name], { skip: true }[, fn])`.
*/
function skip(name?: string, options?: TestOptions, fn?: TestFn): void;
function skip(name?: string, fn?: TestFn): void;
function skip(options?: TestOptions, fn?: TestFn): void;
function skip(fn?: TestFn): void;
/**
* Shorthand for marking a suite as `TODO`, same as `test([name], { todo: true }[, fn])`.
*/
function todo(name?: string, options?: TestOptions, fn?: TestFn): void;
function todo(name?: string, fn?: TestFn): void;
function todo(options?: TestOptions, fn?: TestFn): void;
function todo(fn?: TestFn): void;
/**
* Shorthand for marking a suite as `TODO`, same as `test([name], { only: true }[, fn])`.
*/
function only(name?: string, options?: TestOptions, fn?: TestFn): void;
function only(name?: string, fn?: TestFn): void;
function only(options?: TestOptions, fn?: TestFn): void;
function only(fn?: TestFn): void;
}
/**
* The `describe()` function imported from the `node:test` module. Each
* invocation of this function results in the creation of a Subtest.
Expand Down Expand Up @@ -164,6 +187,13 @@ declare module 'node:test' {
function todo(name?: string, fn?: SuiteFn): void;
function todo(options?: TestOptions, fn?: SuiteFn): void;
function todo(fn?: SuiteFn): void;
/**
* Shorthand for marking a suite as `TODO`, same as `describe([name], { only: true }[, fn])`.
*/
function only(name?: string, options?: TestOptions, fn?: SuiteFn): void;
function only(name?: string, fn?: SuiteFn): void;
function only(options?: TestOptions, fn?: SuiteFn): void;
function only(fn?: SuiteFn): void;
}
/**
* Shorthand for `test()`.
Expand All @@ -186,6 +216,13 @@ declare module 'node:test' {
function todo(name?: string, fn?: TestFn): void;
function todo(options?: TestOptions, fn?: TestFn): void;
function todo(fn?: TestFn): void;
/**
* Shorthand for marking a suite as `TODO`, same as `it([name], { only: true }[, fn])`.
*/
function only(name?: string, options?: TestOptions, fn?: TestFn): void;
function only(name?: string, fn?: TestFn): void;
function only(options?: TestOptions, fn?: TestFn): void;
function only(fn?: TestFn): void;
}
/**
* The type of a function under test. The first argument to this function is a
Expand Down
34 changes: 32 additions & 2 deletions types/node/test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,20 @@ describe.skip('skip shorthand', {
signal: new AbortController().signal,
timeout: Infinity,
});
it.skip('todo shorthand', {
it.skip('skip shorthand', {
concurrency: 1,
only: true,
signal: new AbortController().signal,
timeout: Infinity,
});
test.skip('skip shorthand', {
concurrency: 1,
only: true,
signal: new AbortController().signal,
timeout: Infinity,
});

describe.todo('skip shorthand', {
describe.todo('todo shorthand', {
concurrency: 1,
only: true,
signal: new AbortController().signal,
Expand All @@ -157,6 +163,30 @@ it.todo('todo shorthand', {
signal: new AbortController().signal,
timeout: Infinity,
});
test.todo('todo shorthand', {
concurrency: 1,
only: true,
signal: new AbortController().signal,
timeout: Infinity,
});
describe.only('only shorthand', {
concurrency: 1,
only: true,
signal: new AbortController().signal,
timeout: Infinity,
});
it.only('only shorthand', {
concurrency: 1,
only: true,
signal: new AbortController().signal,
timeout: Infinity,
});
test.only('only shorthand', {
concurrency: 1,
only: true,
signal: new AbortController().signal,
timeout: Infinity,
});

// Test callback mode
describe(cb => {
Expand Down
37 changes: 37 additions & 0 deletions types/node/ts4.8/test.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,29 @@ declare module 'node:test' {
function test(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
function test(options?: TestOptions, fn?: TestFn): Promise<void>;
function test(fn?: TestFn): Promise<void>;
namespace test {
/**
* Shorthand for skipping a suite, same as `test([name], { skip: true }[, fn])`.
*/
function skip(name?: string, options?: TestOptions, fn?: TestFn): void;
function skip(name?: string, fn?: TestFn): void;
function skip(options?: TestOptions, fn?: TestFn): void;
function skip(fn?: TestFn): void;
/**
* Shorthand for marking a suite as `TODO`, same as `test([name], { todo: true }[, fn])`.
*/
function todo(name?: string, options?: TestOptions, fn?: TestFn): void;
function todo(name?: string, fn?: TestFn): void;
function todo(options?: TestOptions, fn?: TestFn): void;
function todo(fn?: TestFn): void;
/**
* Shorthand for marking a suite as `TODO`, same as `test([name], { only: true }[, fn])`.
*/
function only(name?: string, options?: TestOptions, fn?: TestFn): void;
function only(name?: string, fn?: TestFn): void;
function only(options?: TestOptions, fn?: TestFn): void;
function only(fn?: TestFn): void;
}
/**
* The `describe()` function imported from the `node:test` module. Each
* invocation of this function results in the creation of a Subtest.
Expand Down Expand Up @@ -164,6 +187,13 @@ declare module 'node:test' {
function todo(name?: string, fn?: SuiteFn): void;
function todo(options?: TestOptions, fn?: SuiteFn): void;
function todo(fn?: SuiteFn): void;
/**
* Shorthand for marking a suite as `TODO`, same as `describe([name], { only: true }[, fn])`.
*/
function only(name?: string, options?: TestOptions, fn?: SuiteFn): void;
function only(name?: string, fn?: SuiteFn): void;
function only(options?: TestOptions, fn?: SuiteFn): void;
function only(fn?: SuiteFn): void;
}
/**
* Shorthand for `test()`.
Expand All @@ -186,6 +216,13 @@ declare module 'node:test' {
function todo(name?: string, fn?: ItFn): void;
function todo(options?: TestOptions, fn?: ItFn): void;
function todo(fn?: ItFn): void;
/**
* Shorthand for marking a suite as `TODO`, same as `it([name], { only: true }[, fn])`.
*/
function only(name?: string, options?: TestOptions, fn?: ItFn): void;
function only(name?: string, fn?: ItFn): void;
function only(options?: TestOptions, fn?: ItFn): void;
function only(fn?: ItFn): void;
}
/**
* The type of a function under test. The first argument to this function is a
Expand Down