Angular 4 Error: No provider for ChildrenOutletContexts in Karma-Jasmine Test Angular 4 Error: No provider for ChildrenOutletContexts in Karma-Jasmine Test windows windows

Angular 4 Error: No provider for ChildrenOutletContexts in Karma-Jasmine Test


Based on the clue provided by @John, I imported RouterTestingModule instead of importing RouterModule and APP_BASE_HREF. So, the following modification in app.component.spec.ts worked!

import { TestBed, async } from '@angular/core/testing';import { FormsModule } from '@angular/forms';import { RouterTestingModule } from '@angular/router/testing';import { AppComponent } from './app.component';import { DashboardComponent } from './modules/dashboard/dashboard.component';describe('AppComponent', () => {  beforeEach(async(() => {    TestBed.configureTestingModule({      imports: [        RouterTestingModule         FormsModule      ],      declarations: [        AppComponent,        DashboardComponent      ]    }).compileComponents();  }));