使用摩卡进行unit testing的电解质依赖性注入

在electrolyte.js中,我们通常会创build一个模块:emodule.js(example)

exports=module.exports=function(module1,module2,module3){ }; exports["@singleton"]=true; exports["@require"] = ["module1","module2","module3"] 

现在,如果我们想在mochatesting中真正模拟module2,那么我们应该如何调用emodule.js,这样所有对module2的调用都将被redirect到模拟? 感谢任何指针…

你有没有看到像bottlejs( https://github.com/young-steveo/bottlejs )或SimpleDiJs( https://github.com/avighier/simple-dijs )其他dependency injection容器系统?