From 30034e817798810153aae6fe43d5b66e23138d96 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 12 May 2022 13:38:48 -0700 Subject: [PATCH] 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. --- ang/crmUi.ang.php | 4 ++-- karma.conf.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) 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";' + -- 2.25.1