I'm using Storybook to create stories. I want to create tests of the stories using @storybook/testing-react
. However, I'm also using materialize-react
which requires that materialize.min.js
is loaded.
I am loading this in .storybook/preview-head.html
and it works for storybook.
But when I run a test (created as in https://storybook.js.org/addons/@storybook/testing-react), I'm getting Error: Uncaught [ReferenceError: M is not defined]
which I'm pretty sure means that materialize.min.js
is not loaded.
How do I load an external JS file in testing library?