Skip to content

Feature: ability to add async matchers using expect.extend #4223

@danrr

Description

@danrr

Do you want to request a feature or report a bug?
Feature

What is the current behavior?
A custom matcher add using expect.extend needs to synchronously return an object containing pass and message fields.

What is the expected behavior?
Allow async functions to be used as matchers that return a promise which eventually resolves to an object containing pass and message. These would be subject to the usual timeout.

My use case would be to execute async operations on a custom snapshot inside the matcher in a way that's transparent to the user.

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