我用的茉莉和放肆编写单元测试我angularjs解决方案,我不断收到一个的ReferenceError称它不能找到一个变量模块...javascript参考错误
这是错误消息我一直越来越:
Test Name: appControllersTest encountered a declaration exception Test FullName: ..\scripts_references.js::appcontrollerstest::encountered a declaration exception Test Source: ..\scripts_references.js : line 0 Test Outcome: Failed Test Duration: 0:00:00.001 Result Message: ReferenceError: Can't find variable: module in file:../scripts/unittest/controllerstest.js:20
Test Name: appControllersTest encountered a declaration exception Test FullName: ..\scripts\unittest\controllerstest.js::appcontrollerstest::encountered a declaration exception Test Source: ..\scripts\unittest\controllerstest.js : line 16 Test Outcome: Failed Test Duration: 0:00:00.001 Result Message: ReferenceError: Can't find variable: module in file:../scripts/unittest/controllerstest.js:20
这是我的单元测试:
/// <reference path="../_references.js" />
/// <reference path="../AngularJSApp/controllers.js" />
describe("appControllersTest", function() {
var $scope;
beforeEach(module("appMain"));
describe("RRCtrl", function() {
beforeEach(inject(function ($controller) {
$scope = {};
$controller("RRCtrl", { $scope: $scope });
}));
it("JavaTestTest", function ($controller) {
expect(scope.$root.title).toBe("");
});
});
});
有没有人遇到这样那样的错误,你如何解决这个问题?
定义模块功能在哪里? – 2014-09-22 19:57:52
我把它放在/AngularJSApp/app.js – Warsaw 2014-09-23 00:33:26
我试图给整个AngularJSApp文件夹添加一个参考路径,但是我仍然得到了同样的错误信息。 – Warsaw 2014-09-23 00:53:39