"karma" If 'mat-error' is an Angular component, then verify that it is part of this module. code example
Example: 'mat-form-field' is not a known element:
@NgModule({
imports: [
MatButtonModule,
MatFormFieldModule,
MatInputModule,
MatRippleModule,
]
....