Issue
In my test I am importing a jsx file which imports css:
import styles from '~/shared/styles/Profile.css';
I am trying to mock all css files with identity-obj-proxy as I am using css-modules. It doesn't seem to work though.
Package.json
"jest": {
"moduleNameMapper":{
"\\.(css|less)$": "identity-obj-proxy"
},
I also tried:
"jest": {
"moduleNameMapper":{
"^.+\\.(css|less)$": "<rootDir>/config/CSSStub.js"
},
while creating CSSStub.css
module.exports = {};
No effect - still the same parsing css error from Jest.
What am I doing wrong?
Solution
I don't know if you're still having this since the question is around 6 months old but I think you should name your file CSSStub.js
instead of CSSStub.css
.
Answered By - mfakhrusy
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.