Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2 Materials throws warning in karma tests

Whenever I test a component that uses Angular Material inside it I get an annoying warning in the test output that I don't know how to clean up. How do I add a stub or polyfill for HammerJS?

WARN LOG: 'Could not find HammerJS. Certain Angular Material components may not work correctly.'

WARN: 'Could not find HammerJS. Certain Angular Material components may not work correctly.'

Couple notes: I'm using Angular CLI v. 1.0.1 with Angular Materials v. 2.0.0.beta.3

like image 813
efarley Avatar asked Mar 04 '26 19:03

efarley


1 Answers

I have been able to resolve this by adding the following line to the files array in karma.config.js

{ pattern: './node_modules/@angular/material/prebuilt-themes/indigo-pink.css', included: true, watched: true }
like image 169
efarley Avatar answered Mar 06 '26 07:03

efarley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!