This question describes how to update Angular 2 after the beforeEachProviders
function was deprecated.
But having done that, I get the error Cannot read property 'injector' of null
My test is relatively basic:
import { inject, addProviders } from '@angular/core/testing';
import { MyComponent } from './my.component';
describe('Foo', () => {
beforeEach(() => {
addProviders([{
provide: MyComponent,
useClass: MyComponent
}]);
});
it('foo', inject([MyComponent], (e: MyComponent) => {
expect(true).toEqual(true);
}));
});