I have a component that looks like this:
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-youtube',
templateUrl: './youtube.component.html',
styleUrls: ['./youtube.component.css']
})
export class YoutubeComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
In my karma, spec, I have the following:
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { YoutubeComponent } from './youtube.component';
describe('YoutubeComponent', () => {
let component: YoutubeComponent;
let fixture: ComponentFixture<YoutubeComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
// providers: [YoutubeComponent],tried this, and it makes no difference
declarations: [ YoutubeComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(YoutubeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
The error in the Karma browser that I'm getting looks like:
Error: Illegal state: Could not load the summary for directive YouTubeComponent.
It seems that previous, related questions were solved by adding the line declarations: [ YoutubeComponent ]
, which I already have. Any other advice?
A reproducible example is available on github:
git clone https://github.com/Atticus29/dataJitsu.git
cd dataJitsu
git checkout modalSO
rm package-lock.json
npm install
npm test