Angular - Karma - ngrx - No provider for Store

Turns out my problem was I quoting Store in the fixture.debugElement.injector.get('Store') call. Removing the quotes fixed my problem.


You should add

 imports: [
  ...,
 StoreModule.forRoot(fromRoot.reducers),
],

That might help you


With NgRx 7 +, use the MockStore like this:

const initialState = {};
  
  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [LogsNewComponent],
      providers: [
        provideMockStore({ initialState }),
      ],
    }).compileComponents();
  }));