Merge pull request #11154 from agileware/CRM-20421
[civicrm-core.git] / karma.conf.js
index b04979c74437691c26af68d838772ac56cae603b..76a758c2cebc181dee324345fcf15b5e2beaf07e 100644 (file)
@@ -1,21 +1,29 @@
+var cv = require('civicrm-cv')({mode: 'sync'});
+var _CV = cv('vars:show');
+var cmd =
+  'CRM_Core_BAO_ConfigSetting::enableComponent("CiviCase");' +
+  'global $civicrm_root;' +
+  '$f = CRM_Utils_File::addTrailingSlash($civicrm_root)."tmp/karma.cv.js";' +
+  'mkdir(dirname($f), 0777, TRUE);' +
+  '$a=Civi::service("angular");' +
+  '$data = "var CRM = CRM || {}; CRM.angular =";' +
+  '$data .= json_encode(array(' +
+  '   "modules" => array_keys($a->getModules()),' +
+  '   "requires" => $a->getResources(array_keys($a->getModules()), "requires","requires"),' +
+  '));' +
+  '$data .= ";";' +
+  'file_put_contents($f, $data);' +
+  'return $f;';
+var angularTempFile = cv(['php:eval', '-U', _CV.ADMIN_USER, cmd]);
+
 module.exports = function(config) {
   config.set({
     autoWatch: true,
-    browsers: ['PhantomJS', 'PhantomJS_custom'],
-    customLaunchers: {
-      'PhantomJS_custom': {
-        base: 'PhantomJS',
-        options: {
-            windowName: 'my-window',
-            settings: {
-                webSecurityEnabled: false
-            }
-        }
-      }
-    },
+    browsers: ['PhantomJS'],
     exclude: [
     ],
     files: [
+      'bower_components/phantomjs-polyfill/bind-polyfill.js',
       'bower_components/jquery/dist/jquery.min.js',
       'bower_components/jquery-ui/jquery-ui.min.js',
       'bower_components/lodash-compat/lodash.min.js',
@@ -25,6 +33,8 @@ module.exports = function(config) {
       'packages/jquery/plugins/jquery.timeentry.js',
       'js/Common.js',
       'bower_components/angular/angular.js',
+      'js/crm.angular.js',
+      angularTempFile,
       'bower_components/angular-file-upload/angular-file-upload.js',
       'bower_components/angular-jquery-dialog-service/dialog-service.js',
       'bower_components/angular-route/angular-route.js',
@@ -32,7 +42,6 @@ module.exports = function(config) {
       'bower_components/angular-ui-sortable/sortable.js',
       'bower_components/angular-ui-utils/ui-utils.js',
       'bower_components/angular-unsavedChanges/dist/unsavedChanges.js',
-      'tests/karma/modules.js',
       'js/crm.ajax.js',
       'ang/*.js',
       'ang/**/*.js',