I have a small trivial angular2 application which is relying on systemjs
with JiT and AoT compilation.
The key difference here, compared to other setups is that I explicitly do not want to set the moduleId: module.id
into the definition of the component, as there is absolutely no use for it during the AoT compilation (which stands for the desired end-result for production). To get things going in the JiT mode I prefer to host testing server from multiple folders (cp. this reference)
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
// moduleId: module.id,
templateUrl: 'app.component.html',
styleUrls: ['app.component.css']
})
export class AppComponent {
...
}
The only bottleneck here is that I cannot get karma based unit tests working as I was not able to find a way to proxy the template file to the correct location...
When I run karma I am struggling to proxy the path to the template file:
[1] 08 02 2017 13:03:20.768:INFO [karma]: Karma v1.4.1 server started
...
[1] 08 02 2017 13:03:22.579:WARN [web-server]: 404: /app.component.html
Chrome 56.0.2924 (Linux 0.0.0) AppComponent should create component FAILED
[1] Error: This test module uses the component AppComponent which is using a "templateUrl" or "styleUrls", but they were never compiled. Please call "TestBed.compileComponents" before your test.
[1] Expected undefined to be defined.