Currently, I have embarked on the journey of creating unit tests for my Angular Material project. At the moment, my focus is on testing whether the pre-made spec.ts files for each component are passing successfully. Despite the fact that my project compiles and runs without any issues, when running ng test
and checking the results in the Karma Runner, it appears that most of my components are failing on their basic pre-made spec.ts files. Strangely enough, the errors displayed seem to be related to compiler issues, even though my project has no trouble compiling.
The following are some examples of these errors:
Failed: Template parse errors:
Can't bind to 'ngModel' since it isn't a known property of 'input'. ("<mat-form-field class="form-field wide">
Failed: Template parse errors:
'mat-toolbar' is not a known element:
1. If 'mat-toolbar' is an Angular component, then verify that it is part of this module.
It seems that these errors specifically involve Angular Material. Could it be possible that my tests are unaware of the fact that Angular Material has been installed?