Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typescript: fix types for hook functions so they can return 'skipped' #1542

Merged
merged 6 commits into from
Feb 2, 2021

Conversation

davidjgoss
Copy link
Contributor

Fixes #1529.

As part of this, added tsd so we can build up a representative set of TypeScript usages and make sure they don't regress.

@coveralls
Copy link

coveralls commented Jan 16, 2021

Coverage Status

Coverage remained the same at 98.076% when pulling 7a59836 on skipped-typings into 6489d97 on master.

export type TestCaseHookFunctionWithParameter = (
arg: ITestCaseHookParameter
) => void | Promise<void>
) => any | Promise<any>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any is obviously a bit broad but I think it's faithful to the API, in the sense that you can return/resolve anything you want from a hook or step function, but skipped and pending have special meaning.

@charlierudolph
Copy link
Member

Very cool. Haven't seen a types test before

@davidjgoss davidjgoss merged commit 02fcc4f into master Feb 2, 2021
@davidjgoss davidjgoss deleted the skipped-typings branch February 2, 2021 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cannot skip a scenario anymore in v7
3 participants