angular-remove-di-loaders
Version:
Remove DI for angular, support ES6 modules
34 lines (23 loc) • 762 B
JavaScript
var util = require('../lib/util');
/*
Angular Mocks Remove DI Loader
------------------------------
This module strips module() and inject() globals from
*/
function removeAngularMocksDI(angular) {
// Make window.module() a noop
window.module = angular.mock.module = function() {
return function() {
};
};
// Make window.inject() function as a regular angular injector
window.inject = angular.mock.inject = function(method) {
return function() {
return angular.monolith.runInjector.invoke(method);
};
};
}
module.exports = function (content) {
this.cacheable && this.cacheable();
return content + '; (' + removeAngularMocksDI.toString() + ')(window.angular);';
};