diff --git a/types/base.d.ts b/types/base.d.ts index 3bebc6c7e..a827291e3 100644 --- a/types/base.d.ts +++ b/types/base.d.ts @@ -120,5 +120,13 @@ export interface ContextualCallbackTestContext extends CallbackTestContext { context: any; } +export interface Macro { + (t: T, ...args: any[]): void; + title? (providedTitle: string, ...args: any[]): string; +} +export type Macros = Macro | Macro[]; + export function test(name: string, run: ContextualTest): void; export function test(run: ContextualTest): void; +export function test(name: string, run: Macros, ...args: any[]): void; +export function test(run: Macros, ...args: any[]): void; diff --git a/types/make.js b/types/make.js index f33fb2f6f..658c5025c 100644 --- a/types/make.js +++ b/types/make.js @@ -53,6 +53,8 @@ function generatePrefixed(prefix) { const type = testType(parts); output += '\t' + writeFunction(part, 'name: string, implementation: ' + type); output += '\t' + writeFunction(part, 'implementation: ' + type); + output += '\t' + writeFunction(part, 'name: string, implementation: Macros<' + type + 'Context>, ...args: any[]'); + output += '\t' + writeFunction(part, 'implementation: Macros<' + type + 'Context>, ...args: any[]'); } }