ssr-window
ssr-window copied to clipboard
failed in Jest test
I am using this and webpack build and worked fine.. but in jest testing, I am getting this error,
FAIL src/tests/dataLayer.test.js ● Test suite failed to run
Cannot find module 'ssr-window' from 'src/__tests__/dataLayer.test.js'
> 1 | import { getWindow } from 'ssr-window';
I can see the package in node_modules are files with esm, umd module.. is there any other specifci config needs to be added for jest?
Latest ssr-window doesn't have UMD/CJS modules anymore, only ESM which I think may not be supported by Jest. Plus why do you use it in your Jest tests if as I remember Jest already mocks the window globals?