lukeed / clsx

A tiny (239B) utility for constructing `className` strings conditionally.
MIT License
8.12k stars 140 forks source link

Snapshot test failed with auto-generated classname #24

Closed cuongnvicts closed 4 years ago

cuongnvicts commented 4 years ago

Hi @lukeed ,

I've had a problem with snapshot testing (Jest & @testing-library/react). When I run test twice with toMatchSnapshot(), the new snapshot was be different from the old one because of auto-generated classname. Example as:

data-tableid="022204747978025785"

data-tableid="043447615246065774"

I have researched a lot but haven't found how to pass this issue. Do you have any suggestions for me in this case?

Thanks,

lukeed commented 4 years ago

Hey, sorry this has nothing to do with clsx. Will be closing this, but I think you need to look at using identify-obj-proxy in your config. That would certainly help with something like CSS Modules, but I have zero idea what data-tableid is or what that has to do with clsx.

Good luck!