Angularjs 使用莫卡、柴、辛诺JS进行测试时,未定义角度误差
我的问题就在这里,我试图在角度范围内测试控制器。这是控制台在运行命令Angularjs 使用莫卡、柴、辛诺JS进行测试时,未定义角度误差,angularjs,unit-testing,coffeescript,mocha.js,Angularjs,Unit Testing,Coffeescript,Mocha.js,我的问题就在这里,我试图在角度范围内测试控制器。这是控制台在运行命令mocha--compilers coffee:coffee script/register**/*.spec.coffee以运行项目中的所有测试文件时向我抛出的错误 angular.module('weaver.ui.app'); ^ ReferenceError: angular is not defined 我最近添加了angular mock库,确保angular不是未解析的变量,但这并不能解决问题 我的测试文
mocha--compilers coffee:coffee script/register**/*.spec.coffee
以运行项目中的所有测试文件时向我抛出的错误
angular.module('weaver.ui.app');
^
ReferenceError: angular is not defined
我最近添加了angular mock
库,确保angular不是未解析的变量,但这并不能解决问题
我的测试文件的开头如下所示(代码是用CoffeeScript编写的)
如果我取消注释require angular,则错误将变为以下内容,因此我假设这不是正确的方法
\npm\node_modules\angular\angular.js:29016
})(window, document);
^
ReferenceError: window is not defined
如果我完全删除angular.module'weaver.ui.app'行,我会得到一个类似的错误,但这是关于控制器的错误
angular.module('weaver.ui.app').controller('AppDesignSidebarNewcontentCtrl', function($rootScope, $scope) {});
^
ReferenceError: angular is not defined
我希望这里有人能帮我解决这个问题,这个问题困扰了我很长一段时间
请不要以控制员的名字来评判我;)
angular.module('weaver.ui.app').controller('AppDesignSidebarNewcontentCtrl', function($rootScope, $scope) {});
^
ReferenceError: angular is not defined