Plotly v1.45.3: DOMParser is not defined when running tests

Hello guys,I’m using React and when trying to run tests with Jest/Enzyme in plotly.js (latest release) I get the following error:

Tips on how to fix it?

I’m importing Plotly from ‘plotly.js/lib/index-cartesian’;

You’ll need to mock it on the window object, for example:

window.DOMParser = function() {};