Sass support in jest test files appear to be broken
See original GitHub issueIs this a bug report?
Yes
Did you try recovering your dependencies?
Yes
(Write your answer here.)
Which terms did you search for in User Guide?
Sass support
(Write your answer here if relevant.)
Environment
node -v
:npm -v
:yarn --version
(if you use Yarn):npm ls react-scripts
(if you haven’t ejected):
Then, specify:
- Operating system:
- Browser and version (if relevant):
Steps to Reproduce
(Write your steps here:)
1: Update react-scripts to latest release 2: Import styles from ‘component.module.scss’ in component file 3: Import styles from ‘component.module.scss’ in component.test.js
Expected Behavior
(Write what you thought would happen.)
Classnames are imported for component file and test file correctly for comparison
see #3815
Actual Behavior
(Write what happened. Please add screenshots!)
Component imports classNames correctly, test file classnames are undefined
Reproducible Demo
(Paste the link to an example project and exact instructions to reproduce the issue.)
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Syntax Error when test component with SASS file imported
My setup includes a jest.config.js file. I found that if I added "moduleNameMapper" there, it worked. So now my jest.test.config.js looks something like ......
Read more >Testing Sass with Jest
How to test Sass compilation, enforcing good hygiene and testing Sass functions and mixins using Jest.
Read more >How To Set Up Next.JS With Jest, React Testing Library and ...
Let's break it down: collectCoverageFrom : Tells Jest that we want to collect via a glob pattern (basically just saying we want to...
Read more >jest-preview | Yarn - Package Manager
Preview your Jest tests in a browser ... Display full readme Display full readme ... Support viewing SVG when importing as a component...
Read more >How to Import a Sass File into Every Vue Component in an App
If you have to redefine some base pieces of your application in every component, it will begin to break down, just like a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
it also appears that importing css modules is not working as expected either.
Using this configuration:
I’m going to attempt a PR too 😃