I'm having trouble importing and mounting a component in Jest. Unfortunately, I keep getting an error message that says:
styles/variables.scss:2
$blue:#324157;
^
SyntaxError: Invalid or unexpected token
I've tried a few solutions, but none of them have worked for me.
Attempted Solution 1 - Using identity-obj-proxy (FAILED):
"moduleNameMapper": {
"\\.(css|scss|sass|less)$": "identity-obj-proxy"
}
Attempted Solution 2 - Using styleMock (FAILED):
//package.json
"moduleNameMapper": {
"\\.(css|scss|sass|less)$": "<rootDir>/tests/__mocks__/styleMock.js"
}
//<rootDir>/tests/__mocks__/styleMock.js
module.exports = {}
Unfortunately, neither of these solutions have resolved the error for me.