Are you running latest CRA? If so then this issue https://github.com/facebook/create-react-app/pull/8362 might be what you’re experiencing. That’s solvable by installing https://www.npmjs.com/package/jest-environment-jsdom-sixteen, e.g. $ yarn add -D jest-environment-jsdom-sixteen and editing your test script:
...
"scripts": {
...
- "test": "react-scripts test --env=dom"
+ "test": "react-scripts test --env=jest-environment-jsdom-sixteen"
...
},
...
"devDependencies": {
...
"jest-environment-jsdom-sixteen": "^1.0.3",
...
},
...
Essentially you will tell your jest to use jsdom v16 instead of v15(default for Jest v25).