这是我的规范文件:
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();
});
});
我收到此错误:
最佳答案
如果您使用了NgModule并缺少NgModule进行导入,那么我们会期望此类错误。
因此,如果您正在使用NgModule,请确保将其导入:"import {NgbModule} from '@ng-bootstrap/ng-bootstrap';"
关于angular - 模块 'DecoratorFactory'导入的意外值 'DynamicTestModule'。请添加@NgModule批注,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47747353/