Skip to content

Improve error message for non-function arg passed to waitFor #509

Closed
@Belco90

Description

@Belco90

Describe the feature you'd like:

New waitFor async utils expects a callback function as first argument. Though if something else is passed there, the error looks like this:
wait-for

It's difficult to figure out the actual error with that message (it took me few minutes to found this in a project where I was migrating dom-testing-library to the last version!). I'd like to get a better message for this case.

Suggested implementation:

This would be as simple as throw an error at first line of waitFor implementation if typeof callback !== 'function'. I'm happy to implement this myself, though I'm not sure which message should I write so I'd like to discuss that here.

Describe alternatives you've considered:

n/a

Teachability, Documentation, Adoption, Migration Strategy:

n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions