2016-02-19 126 views
2

依賴加載模塊我有一個被定義爲這樣一個模塊:與茉莉花

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模塊的值。

我該如何加載一個具有依賴性的模塊?

回答

0

事實證明,Jasmine沒有加載engine模塊,因爲我已經使用了ES6語法。我會提出一個新的問題。