I'm currently writing a simple test to test an Angular 2 component whose template is referenced with a templateUrl. I am currently using webpack to perform the tasks required, including testing. I was following the webpack guide on the angular site as well as the AngularClass' angular2-webpack-starter repo.
However, when the test tries to create a component fixture, using
testBed.createComponent(AppComponent);
I am getting the following error:
"'Unhandled Promise rejection:', 'Failed to load app.component.html', '; Zone:', 'ProxyZone', '; Task:', 'Promise.then', '; Value:', 'Failed to load app.component.html',"
thus obviously resulting in a failing test.
In my app.component.ts i'm refering the template via templateUrl like so
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ]
})
export class AppComponent {
title = "Tour of Heroes";
}
I Have looked around but haven't found a solution for this error. Anybody aware of this issue please? All the examples which I have encountered so far (for example like the ones in this repo https://github.com/rangle/angular2-redux-example) all include inline html.
Here's a link to my repo in case you would like to see the webpack / karma config files. https://github.com/jeanpaulattard/tourofheroes
Edit: Updated link to the master branch of my repo.