jest-extended icon indicating copy to clipboard operation
jest-extended copied to clipboard

ToBeEmpty assertion in jest-extended collides with jest-dom's one

Open DanielaValero opened this issue 4 years ago • 0 comments

Describe the feature you'd like:

Jest-Extended has an assertion named the same as jest-extended'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, in my case the version of jest-extended overwrites the one from jest-dom. But this might vary depending on the order used to add the libs

Describe alternatives you've considered:

Maybe an option is to add an alias for toBeEmpty named toBeEmptyValue or something ?

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 toBeEmptyValue" or something like this

However, 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.

https://github.com/facebook/jest/issues/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.

DanielaValero avatar Mar 17 '20 18:03 DanielaValero