angular 单元测试报错:NullInjectorError
2021-01-06 本文已影响0人
gstorm
测试中添加RouterTestingModule
模块就可以解决
import { RouterTestingModule } from '@angular/router/testing';
...
beforeEach(() => TestBed.configureTestingModule({
imports: [ RouterTestingModule ]
}));