我有这个奇怪的问题,我将一个函数传递给addMockModule参数,它以字符串的形式返回:
functionName: "functionlogic"
变量等静态引用可以正常工作。这是代码:
var x = function sayHello() {console.info('Say hello!')}
browser.addMockModule('moduleName', function(x) {
function runBlock(){$httpBackend) {
console.info(x); // returns x function as a string
x(); //returns unknown error: x is not a function
}
angular.module('moduleName', ['ngMockE2E', 'myApp'])
.run(runBlock);
runBlock.$inject = ['$httpBackend'];
}, x);