Skip to content

assert.rejects() and asserts.not.rejects() for promises #131

@aral

Description

@aral

It would be nice to have an async equivalent of assert.throws() for promise rejections.

While this can be handled via a workaround, having a separate method does cut down on boilerplate.

Instead of overloading throws, I feel it makes sense to have a separate method for promise rejections. This way throws is always sync and rejects is always async.

I understand if you’d rather just keep throws and the workaround, just wanted to share my addition upstream. Please feel free to close this issue and the pull request if you feel this is out of scope or complicates the API beyond what you’re comfortable with.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions