kadoshms/react-jvectormap

document.createStyleSheet is not a function

Opened this issue · 0 comments

I am using Jest to run smoke tests on my components using render() method from @testing-library/react. All my other tests pass except for the test that instantiates and renders the jvectormap (the wrapper component). I have tried multiple jest config solutions as well as jest config at top of file. Nothing works.

`Summary of all failing tests
FAIL src/components/WorldMapComponent.test.jsx
● renders without error

TypeError: document.createStyleSheet is not a function

  at Function.jvm.VMLElement.initializeVML (webpack:/@react-jvectormap/jvectormap/jquery.jvectormap.min.js?:745:12)
  at jvm.VMLCanvasElement.jvm.VMLElement [as constructor] (webpack:/@react-jvectormap/jvectormap/jquery.jvectormap.min.js?:696:20)
  at new jvm.VMLCanvasElement (webpack:/@react-jvectormap/jvectormap/jquery.jvectormap.min.js?:806:36)`

React v18, Node v18, create-react-app, jest, standardjs