I had a similar problem when using a project requiring a URL (location.href). You can configure jokes using testURL in your configuration.
Here is what you can add to your package package.json (if that is the way you configure jokes).
"jest": { ...other config, "testURL": "http://localhost:8080/Dashboard/index.html" }
testURL Doc
If you need more specific changes to jsdom, you can install jsdom yourself and import and configure it separately from the joke. Here is an example:
test.js
'use strict'; import setup from './setup'; import React from 'react'; import { mount } from 'enzyme'; import Reportlet from '../components/Reportlet.jsx'; it('Reportlet Renders', () => { ...some test stuff });
setup.js
import jsdom from 'jsdom'; const DEFAULT_HTML = '<html><body></body></html>';
source share