This is such an annoying error, thought I’d include another subtle cause to look for in your spec. In my case I specified providers instead of the correct value of provide as below
TestBed.configureTestingModule({
providers: [{provider: ApplicationActions, useClass: ActionMock}]
rather than offer useful information like “no ‘provide’ key specified” it simply reports
Failed: Invalid provider for the NgModule ‘DynamicTestModule’ – only
instances of Provider and Type are allowed, got: [?[object Object]?,
…]