2017-12-11 7 views
0

Dies ist meine Spec-Datei:Unerwarteter Wert 'DecoratorFactory' wurde vom Modul 'DynamicTestModule' importiert. Bitte fügen Sie eine @NgModule Anmerkung

import { ComponentFixture, TestBed, async } from '@angular/core/testing'; 
import { By }    from '@angular/platform-browser'; 
import { DebugElement } from '@angular/core'; 
import { ScorecardComponent } from './scorecard.component'; 
import { DataService } from '../data.service'; 
import { HttpModule } from '@angular/http'; 
import { Component } from '@angular/core'; 

describe('ScorecardComponent',() => { 

    let comp: ScorecardComponent; 
    let fixture: ComponentFixture<ScorecardComponent>; 
    let de:  DebugElement; 
    let el:  HTMLElement; 

    beforeEach(async(() => { 
    TestBed.configureTestingModule({ 
     declarations: [ ScorecardComponent ], 
     imports: [ Component, HttpModule ], 
     providers: [ DataService ] 
    }) 
    .compileComponents(); 
    })); 

    beforeEach(() => { 
    fixture = TestBed.createComponent(ScorecardComponent); 
    comp = fixture.componentInstance; 
    fixture.detectChanges(); 
    }); 

    it('should create',() => { 
    expect(comp).toBeTruthy(); 
    }); 


}); 

ich diese Störung erhalte:

Unexpected value 'DecoratorFactory' imported by the module 'DynamicTestModule'. Please add a @NgModule annotation.

+0

Entfernen 'Component' aus Importen Array – yurzui

+0

wenn ich Komponente aus Importen Array entfernen habe ich unter fehler- – suha

+0

es entfernen hier' Importe: [Komponente, Httpmodule] , ' – yurzui

Antwort

0

wenn Sie NgModule verwendet haben und fehlende NgModule wir solche Art ein Fehler erwarten zu importieren . So stellen Sie sicher, NgModule zu importieren, wenn Sie es verwenden: "import {NgbModule} from '@ng-bootstrap/ng-bootstrap';"

Verwandte Themen