Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CONTRIBUTING.md) on how to contribute to Cucumber.

## [Unreleased]
### Fixed
- Fix return type of step hook function to allow async functions ([#2038](https://github.com/cucumber/cucumber-js/pull/2038))

## [8.2.0] - 2022-05-05
### Changed
Expand Down
2 changes: 1 addition & 1 deletion src/support_code_library_builder/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export type TestCaseHookFunction<WorldType> = (
export type TestStepHookFunction<WorldType> = (
this: WorldType,
arg: ITestStepHookParameter
) => void
) => any | Promise<any>

export type TestStepFunction<WorldType> = (
this: WorldType,
Expand Down
8 changes: 8 additions & 0 deletions test-d/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ After(function () {})
BeforeStep(function () {})
AfterStep(function () {})

// should allow hook functions to be async
BeforeAll(async function () {})
AfterAll(async function () {})
Before(async function () {})
After(async function () {})
BeforeStep(async function () {})
AfterStep(async function () {})

// should allow typed arguments in hooks
Before(function (param: ITestCaseHookParameter) {})
After(function (param: ITestCaseHookParameter) {})
Expand Down