Skip to content

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

Closed
@aduth

Description

@aduth

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions