Error: “component cannot define both template and templateUrl”

Repost from StackOverflow. Hope that’s ok.

I have some karma/phantomjs tests that used to work but now give me this error for every component even though the components do not in fact define both template and templateUrl.

I don’t know whether it’s related but I am also getting many reports of this error:

Error: <spyOn> : could not find an object to spy upon for find()
Usage: spyOn(<object>, <methodName>) in /Users/Dan/work/bernierebuttals/gba/node_modules/jasmine-core/lib/jasmine-core/jasmine.js (line 4304)

I noticed both at the same time but I had made a lot of changes without running tests very often.

If you can think of a possible solution or even a way to debug this kind of test in my kind of project, I would be very happy.

The repository is here

...
@Component({
    selector: 'jhi-activate',
    templateUrl: './activate.component.html'
})
export class ActivateComponent implements OnInit {
...

and the compiled js looks like

ActivateComponent = __decorate([
    core_1.Component({
        selector: 'jhi-activate',
        template: __webpack_require__("./src/main/webapp/app/account/activate/activate.component.html")
    }),
    __metadata("design:paramtypes", [activate_service_1.Activate,
        shared_1.LoginModalService,
        router_1.ActivatedRoute])
], ActivateComponent);
exports.ActivateComponent = ActivateComponent;

This is from the test log. If you need to see all of it let me know. I’m not yet allowed to post a question with 3 links.

...
PhantomJS 2.1.1 (Mac OS X 0.0.0) Component Tests ActivateComponent calls activate.get with the key from params FAILED
	Failed: 'ActivateComponent' component cannot define both template and templateUrl
	normalizeTemplate@spec/entry.ts:62868:209
	_loadDirectiveMetadata@spec/entry.ts:63811:92
	spec/entry.ts:64007:76
	forEach@[native code]
	loadNgModuleDirectiveAndPipeMetadata@spec/entry.ts:64006:48
	spec/entry.ts:75202:94
...

The error is thrown by this line of Angular code

...
if (prenormData.template != null) {
  if (prenormData.templateUrl != null) {
    throw syntaxError(
        `'${stringify(prenormData.componentType)}' component cannot define both template and templateUrl`);
  }
...