From: Tim Otten Date: Thu, 12 May 2022 20:38:48 +0000 (-0700) Subject: karma - Allow execution with debug_mode=1. Hide jsonFormatter. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=30034e817798810153aae6fe43d5b66e23138d96;p=civicrm-core.git karma - Allow execution with debug_mode=1. Hide jsonFormatter. Before ------ If you enable `debug_mode=1` and run `karma`, it produces a large number of failures: ``` PhantomJS 2.1.1 (Mac OS 0.0.0): Executed 81 of 81 (55 FAILED) (2.686 secs / 2.387 secs) ``` After ----- If you enable `debug_mode=1` and run `karma`, it passes: ``` PhantomJS 2.1.1 (Mac OS 0.0.0): Executed 81 of 81 SUCCESS (7.232 secs / 6.95 secs) ``` Comments -------- The `jsonFormatter` plugin is a DX nicety; when browsing a page with `?angularDebug=1` and with `debug_mode=1`, it will load extra files so that `` panels look pretty. But ordinarily, loading these files is extraneous. --- diff --git a/ang/crmUi.ang.php b/ang/crmUi.ang.php index 2166302163..3351c87485 100644 --- a/ang/crmUi.ang.php +++ b/ang/crmUi.ang.php @@ -1,6 +1,6 @@ get('debug_enabled'); +$isPretty = \Civi::settings()->get('debug_enabled') && !defined('CIVICRM_KARMA'); return [ 'ext' => 'civicrm', @@ -13,6 +13,6 @@ return [ 'ui.utils', ], // Only require the +10kb if we're likely to need it. - $isDebug ? ['jsonFormatter'] : [] + $isPretty ? ['jsonFormatter'] : [] ), ]; diff --git a/karma.conf.js b/karma.conf.js index 787b6752c2..d55ae83787 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,6 +1,7 @@ var cv = require('civicrm-cv')({mode: 'sync'}); var _CV = cv('vars:show'); var cmd = + 'define("CIVICRM_KARMA", 1);' + 'CRM_Core_BAO_ConfigSetting::enableComponent("CiviCase");' + 'global $civicrm_root;' + '$f = CRM_Utils_File::addTrailingSlash($civicrm_root)."tmp/karma.cv.js";' +