Merge pull request #19588 from MegaphoneJon/core-2379
[civicrm-core.git] / karma.conf.js
index 8a7ba6eaa212504007b6ed219a41ca23db66d303..1710c33fdc590a2ebc269766c99e930cde51ba5f 100644 (file)
@@ -1,8 +1,27 @@
+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'],
     exclude: [
+      'ang/api4Explorer/Explorer.js'
     ],
     files: [
       'bower_components/phantomjs-polyfill/bind-polyfill.js',
@@ -14,7 +33,10 @@ module.exports = function(config) {
       'bower_components/jquery-validation/dist/jquery.validate.min.js',
       'packages/jquery/plugins/jquery.timeentry.js',
       'js/Common.js',
+      'js/crm.datepicker.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',
@@ -22,7 +44,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',
@@ -44,6 +65,7 @@ module.exports = function(config) {
     port: 9876,
     reporters: ['progress'],
     junitReporter: {
+      useBrowserName: false,
       outputFile: 'tests/output/karma.xml',
       suite: ''
     },