This repository has been archived by the owner on Oct 19, 2022. It is now read-only.
Reflect CSS Modules classnames in snapshots #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Mock (S)CSS file imports in such a way that when they're asked for some property, they return that same property name.
This way,
becomes
in a snapshot!
This technique/library is based directly on the suggestion in Jest docs. Without it, a lot of the snapshots are useless as they always render either
className="undefined"
orclassName=""
(I don't know why it's one sometimes and the other other times).Unfortunately, I currently don't know of a way to test this, other than by modifying my local
node_modules
. I tried creating a new app using a script from my fork of the repo but I cannot do that because of the way the repo is structured — it lacks a package name and cannot be installed directly with yarn/npm. I believe only thepackages/react-scripts
part gets published on npm? Please tell me if there is some convenient-ish way for me to test this, otherwise I may have to resort to publishing my fork as its own package...