// require all modules ending in ".spec" from the // current directory and all subdirectories import 'angular'; import 'angular-mocks'; window.inject = angular.mock.inject; window.ngModule = function(moduleName) { return angular.mock.module(moduleName, function($provide, $translateProvider) { // Avoid unexpected request warnings caused by angular translate // https://angular-translate.github.io/docs/#/guide/22_unit-testing-with-angular-translate $provide.factory('customLocaleLoader', function($q) { return function() { let deferred = $q.defer(); deferred.resolve({}); return deferred.promise; }; }); $translateProvider.useLoader('customLocaleLoader'); }); }; let testsContext = require.context('./', true, /\.spec\.js$/); testsContext.keys().forEach(testsContext); let modulesContext = require.context('../modules/', true, /^\.\/[a-z0-9]+\/front\/.+\.spec\.js$/); modulesContext.keys().forEach(modulesContext);