[react-jss] Jest tests error
- Dominant language
- JavaScript
- Stars
- 7.1k
- Forks
- 386
- PR merge metrics
- No merged PRs in 30d
Description
Problem with testing react with jest. I am getting this error whenever I use jss in a component.

Also i have a valid config for jest:
```
{
"moduleDirectories": [
"node_modules",
"src"
],
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|pdf)$": "identity-obj-proxy"
},
"preset": "ts-jest",
"roots": [
"/src"
],
"setupFilesAfterEnv": [
"/src/setupTests.js"
],
"testEnvironment": "jsdom",
"testMatch": [
"/src/**/__tests__/**/*.{ts,tsx}",
"/src/**/*(*.)(spec|test).{ts,tsx}",
"/test/**/*.{ts,tsx}",
"/test/**/?(*.)(spec|test).{ts,tsx}"
],
"transform": {
"^.+\\.tsx?$": "ts-jest",
"^.+\\.jsx?$": "babel-jest"
},
"verbose": true
}
```
Contributor guide
Research direction
Start by reproducing the reported Jest failure with the configuration shown in the issue, including src/setupTests.js and the jsdom environment. Inspect the linked error screenshot and determine whether the failure is specific to a component using JSS; done means the relevant Jest test runs without the reported error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100