4

我在 Visual Studio 2013 Update 2 中使用 Chutzpah,我正在尝试使用 jasmine 对 AngularJS 进行一些单元测试。问题是由于某种原因 chutzpan 认为我的参考 javascript 文件是要测试的文件。
无论我在哪里包含参考文件(在测试文件或 Chutzpah.json 中),我都会得到相同的错误。
例如,如果我包括:

/// <reference path="Scripts/angular.js" />
/// <reference path="Scripts/angular-mocks.js" />
/// <reference path="../codeToTest" />

describe('Controller: myController', function () {

    beforeEach(module('myApp'));
});

我得到:

Error: TypeError: 'undefined' is not an object (evaluating 'angular.mock = {}')  

ReferenceError: Can't find variable: module in file.

有什么想法我错了吗?谢谢!

更新:所以伙计们,我只是通过在测试文件和 chutzpah.json 中添加参考文件来解决问题。

4

1 回答 1

3

你在这里有两个选择。您可以创建一个 chutzpah.json 文件并在其中包含引用,或者您可以将 /// 引用更改为 /// chutzpah_reference 您可以在此处找到更多信息:https ://chutzpah.codeplex.com/wikipage?title=Chutzpah %20文件%20参考

于 2014-06-22T12:47:50.383 回答