After adding the react-slick slider to my webpack project, my chai test began to fail with
C:\project\projjs\node_modules\enquire.js\dist\enquire.js:226
throw new Error('matchMedia not present, legacy browsers require a polyfill');
^
Error: matchMedia not present, legacy browsers require a polyfill
at Object.MediaQueryDispatch (C:\project\projjs\node_modules\enquire.js\dist\enquire.js:226:19)
at C:\project\projjs\node_modules\enquire.js\dist\enquire.js:291:9
at i (C:\project\projjs\node_modules\enquire.js\dist\enquire.js:11:20)
at Object.
The only fix for this problem that the author of the slider component recommended here is for jest. I have tried that in my environment but it did not work.
I ended up throwing this react-slick slider into the garbage and creating my own slider instead. The react-slick slider is useless if only because unlike most npm packages out there, it managed to entangled itself with some arcane dependency. Perhaps platform specific requirement which the creator failed to communicate to prospective users. Completely useless unless you intend to test with jest.
@steelow It fixed for me adding this on my mocha setup:
global.window.matchMedia = window.matchMedia || (() => ({}));
global.matchMedia = global.window.matchMedia;
Most helpful comment
@steelow It fixed for me adding this on my mocha setup: