Skip to content

ToBeEmpty assertion in jest-dom is also used in jest-extended #216

Closed
@DanielaValero

Description

@DanielaValero

Describe the feature you'd like:

Jest-Extended has an assertion named the same as jest-dom's one:

-> https://github.com/jest-community/jest-extended#tobeempty
-> https://github.com/testing-library/jest-dom#tobeempty

When both libs are used in the same project, the version of jest-extended overwrites the one from jest-dom.

Describe alternatives you've considered:

Maybe an option is to add an alias for toBeEmpty named toBeEmptyNode ?

Teachability, Documentation, Adoption, Migration Strategy:

I am not sure at this moment how the things work, could it be an option to have 2 names for the same assertion?

If yes, then the documentation could say:
"if you are using jest-extended, then use toBeEmptyNode" or something like this

edit
I have raised a feature request in Jest Itself asking for a feat that warns the user about the name collision and points out to a link where is documented a way to rename one of the colliding names in the project where the situation happens.

jestjs/jest#9678

It could be that the warning and the documentation of how to solve it in projects, might be enough to address this and similar situations like this one.

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