ssr-window icon indicating copy to clipboard operation
ssr-window copied to clipboard

failed in Jest test

Open xinzhang opened this issue 3 years ago • 1 comments

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?

xinzhang avatar Oct 13 '21 00:10 xinzhang

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?

nolimits4web avatar Oct 13 '21 08:10 nolimits4web