Skip to content

wait doesn't suppress errors if options (timeout) is passed #6

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

Closed
aduth opened this issue Sep 13, 2020 · 0 comments · Fixed by #9
Closed

wait doesn't suppress errors if options (timeout) is passed #6

aduth opened this issue Sep 13, 2020 · 0 comments · Fixed by #9

Comments

@aduth
Copy link
Contributor

aduth commented Sep 13, 2020

Example: https://runkit.com/aduth/5f5e53aa8ef9ae0013364071

The default value for suppressErrors (true) is only assigned if no options parameter is assigned:

options: TimeoutOptions = { timeout: 0, suppressErrors: true }

This means if a developer passes options (either an empty object, or with timeout), any errors thrown during wait will not be suppressed.

if (!options.suppressErrors) {
throw err;

@testing-library/react-hooks addresses this by assigning default value during destructuring of the options:

https://github.com/testing-library/react-hooks-testing-library/blob/b16f8bb/src/asyncUtils.js#L41

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 a pull request may close this issue.

1 participant