TypeScript - jasmine - Chutzpah - AngularJS

2019-04-16 08:58发布

问题:

Hi we are using angulatJs with typescript. For unit testing we are using Jasmine. And to run jasmine we are using Chutzpah.

When i am trying to build project it giving me an error that

ReferenceError: Can't find variable: angular

Where i have added reference to the .spect.ts correctly.

 ///<reference path="../external/angularJS/1.0.8/angular.d.ts" />
 ///<reference path="../external/angularJS/1.0.8/angular-ui.d.ts" />
 ///<reference path="../external/angularJS/1.0.8/angular-mocks.d.ts" />
 ///<reference path="../_references.d.ts" />

But still i am getting the ReferenceError: Can't find variable: angular

Any suggestion ??

Thanks

回答1:

Those references are to the .d.ts file but Chutzpah needs to know where the actual implementation .js files are. You can do this using

/// <chutzpah_reference path="path/to/angular.js" >
/// <chutzpah_reference path="path/to/angular-ui.js" >
/// <chutzpah_reference path="path/to/angular-mock.js" >