diff --git a/types/node/index.d.ts b/types/node/index.d.ts index dd9fda0ab8d028..97cb955b6465d1 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -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 // DefinitelyTyped diff --git a/types/node/test.d.ts b/types/node/test.d.ts index 3d1cb9ce914252..4560ffc44be558 100644 --- a/types/node/test.d.ts +++ b/types/node/test.d.ts @@ -135,6 +135,29 @@ declare module 'node:test' { function test(name?: string, options?: TestOptions, fn?: TestFn): Promise; function test(options?: TestOptions, fn?: TestFn): Promise; function test(fn?: TestFn): Promise; + 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. @@ -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()`. @@ -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 diff --git a/types/node/test/test.ts b/types/node/test/test.ts index 16935135284696..66ed7caa5d2d2f 100644 --- a/types/node/test/test.ts +++ b/types/node/test/test.ts @@ -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, @@ -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 => { diff --git a/types/node/ts4.8/test.d.ts b/types/node/ts4.8/test.d.ts index 614f94d5099aea..51614d357a202d 100644 --- a/types/node/ts4.8/test.d.ts +++ b/types/node/ts4.8/test.d.ts @@ -135,6 +135,29 @@ declare module 'node:test' { function test(name?: string, options?: TestOptions, fn?: TestFn): Promise; function test(options?: TestOptions, fn?: TestFn): Promise; function test(fn?: TestFn): Promise; + 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. @@ -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()`. @@ -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