Closed davidpaley closed 1 year ago
Just for the record, I could fix this setting diagnostics
to false:
"globals": {
"ts-jest": {
"diagnostics": false
}
}
I am also using babel-jest for the moduleNameMapper
"moduleNameMapper": {
"^.+\\.(css|less|scss)$": "babel-jest"
},
For anyone who runs into this issue, I have created a repo to demonstrate how to fix this issue besides the workaround above by @davidpaley . You can find it here https://github.com/ahnpnl/react-ts-jest-babel
@ahnpnl your link is not available anymore. @davidpaley your approach worked, however I'm not sure why. Do you know why?
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
I am using a React app using create-react-app, CSS Modules with SASS, and Typescript. For files that do not need styles, the automated tests work great. However, when I test some file that has styles I get this error:
Some relevant files related with this:
jest.setMock('cross-fetch', fetchMock);
const localStorageMock = { getItem: jest.fn(), setItem: jest.fn(), clear: jest.fn(), }; global.localStorage = localStorageMock;
{ "compilerOptions": { "outDir": "./dist/", "sourceMap": true, "noImplicitAny": true, "module": "commonjs", "target": "es6", "jsx": "react", "esModuleInterop": true }, "include": ["./src/*/"] }