Skip to content

Commit

Permalink
fix: align hooks return types with their behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Jun 21, 2022
1 parent 2d9cc41 commit 5a2360b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/vitest/src/types/tasks.ts
Expand Up @@ -122,17 +122,17 @@ SuiteCollector<ExtraContext>
runIf(condition: any): SuiteAPI<ExtraContext>
}

export type HookListener<T extends any[], Return = void> = (...args: T) => Awaitable<Return | void>
export type HookListener<T extends any[], Return = void> = (...args: T) => Awaitable<Return>

export type HookCleanupCallback = (() => Awaitable<unknown>) | void

export interface SuiteHooks {
beforeAll: HookListener<[Suite | File], () => Awaitable<void>>[]
beforeAll: HookListener<[Suite | File], HookCleanupCallback>[]
afterAll: HookListener<[Suite | File]>[]
beforeEach: HookListener<[TestContext, Suite], () => Awaitable<void>>[]
beforeEach: HookListener<[TestContext, Suite], HookCleanupCallback>[]
afterEach: HookListener<[TestContext, Suite]>[]
}

export type HookCleanupCallback = (() => Awaitable<void>) | void

export interface SuiteCollector<ExtraContext = {}> {
readonly name: string
readonly mode: RunMode
Expand Down

0 comments on commit 5a2360b

Please sign in to comment.