在 Jasmine 中加载具有依赖项的模块
Loading modules with dependencies in Jasmine
>我有一个模块,定义如下:
var angular_multi_select_engine = angular.module('angular-multi-select-engine', [
'angular-multi-select-constants'
]);
如您所见,engine
取决于constants
模块。
我正在尝试在engine
上运行一些测试,带有这个:
beforeEach(function() {
angular.mock.module('angular-multi-select-engine', 'angular-multi-select-constants');
});
但是当我尝试运行茉莉花时,它说:
Error: [$injector:modulerr] Failed to instantiate module angular-multi-select-engine due to:
[$injector:nomod] Module 'angular-multi-select-engine' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
如果我尝试仅加载constants
模块,Jasmine 将按预期工作,我可以测试constants
模块的值。
我应该如何加载具有依赖项的模块?
事实证明,Jasmine 没有加载 engine
模块,因为我使用了 ES6 语法。我将对此提出一个新问题。
相关文章:
- 将依赖外部库的UMD模块与browserfy捆绑在一起
- 节点模块依赖关系
- 限制npm依赖模块's require(隔离)的用法
- 要求创建空模块作为依赖项加载程序
- 如何使用jasmine节点监视依赖模块内部的方法
- 库中的匿名定义()模块's的依赖关系导致库损坏'的家属
- 角度模块依赖项的命名约定
- JavaScript模块化和依赖注入之间的区别
- ES6模块导入和依赖关系管理
- 要安装依赖项的自定义节点模块
- 阻止浏览包含模块'的依赖关系
- Javascript应用程序作为具有外部依赖关系的AMD模块
- 如何管理不同的 Angular 模块依赖关系
- 打包具有依赖关系的Browser/Server CommonJS模块
- 在 Angular 中动态注入依赖模块
- RequireJS - 先初始化一个依赖模块,然后再加载其他模块
- 将ngAnimate包含为依赖模块时出错
- Javascript在单元测试中用模拟版本修补现有的外部依赖模块方法
- 使用 RequireJS 自动加载依赖模块
- Angularjs中的多依赖模块