TypeError Uncaught [объект Object] thrownr Uncaught [объект Object] брошенный - PullRequest
0 голосов
/ 08 марта 2019

Я получаю эту ошибку при тестировании ng test --code-coverage true:

Ошибка: выброшен Uncaught [объект объекта]

Файл Spec.ts:

 import { async, ComponentFixture, TestBed, inject, tick, fakeAsync } from 
 '@angular/core/testing';
 import { NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA, Injectable, 
 DebugElement, 
 Inject } from '@angular/core';
 import {CustomComponent} from './custom-component';
 describe('CustomComponent', () => {
 let component: CustomComponent;
 let fixture: ComponentFixture<CustomComponent>;
 beforeEach(async(() => {
 TestBed.configureTestingModule({
 imports: [ReactiveFormsModule, FormsModule, CookieModule.forRoot(), 
 HttpClientModule, HttpModule],
 declarations: [CustomComponent],
 providers: [],
 schemas: [NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA]
 }).compileComponents();
 }));
 beforeEach(fakeAsync(() => {
fixture = TestBed.createComponent(CustomComponent);
component = fixture.componentInstance;
fixture.detectChanges();
tick();
}));
it('is form invalid when empty', fakeAsync(() => {
const fixture = TestBed.createComponent(CustomComponent);
const component = fixture.debugElement.componentInstance;
fixture.detectChanges();
expect(component.form.valid).toBeFalsy();
}));
});
...