From a3dafbe7a5023407587b38584023a36c636b0b1c Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Thu, 2 Jul 2020 15:47:38 +0200
Subject: [PATCH] rollup: add a new test-full command and run tests without
 terser/babel by default

babel and terser make tests run really slow, so try to make it optional.
---
 .gitlab-ci.yml   | 2 +-
 package.json     | 3 ++-
 rollup.config.js | 9 +++++----
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 70839c4..5d9bc62 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -13,7 +13,7 @@ test:
   script:
     - npm install
     - npm run build-dev
-    - npm test
+    - npm run test-full
 
 linting:
   stage: test
diff --git a/package.json b/package.json
index 1f24e91..1737e5b 100644
--- a/package.json
+++ b/package.json
@@ -68,8 +68,9 @@
     "i18next": "i18next-scanner",
     "watch": "rollup -c --watch",
     "watch-local": "npm run watch",
-    "watch-full": "rollup -c --watch --environment WATCH_FULL",
+    "watch-full": "rollup -c --watch --environment FORCE_FULL",
     "test": "rollup -c --environment BUILD:test && karma start --singleRun",
+    "test-full": "rollup -c --environment FORCE_FULL,BUILD:test && karma start --singleRun",
     "lint": "eslint ."
   }
 }
diff --git a/rollup.config.js b/rollup.config.js
index eaa236e..30dc8e1 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -29,7 +29,8 @@ const USE_HTTPS = false;
 const pkg = require('./package.json');
 const build = (typeof process.env.BUILD !== 'undefined') ? process.env.BUILD : 'local';
 const watch = process.env.ROLLUP_WATCH === 'true';
-const watchFull = process.env.WATCH_FULL !== undefined;
+const buildFull = (!watch && build !== 'test') || (process.env.FORCE_FULL !== undefined);
+
 console.log("build: " + build);
 let basePath = '';
 let entryPointURL = '';
@@ -41,9 +42,9 @@ let keyCloakBaseURL = '';
 let keyCloakClientId = '';
 let pdfAsQualifiedlySigningServer = '';
 let matomoSiteId = 131;
-let useTerser = !watch || watchFull;
-let useBabel = !watch || watchFull;
-let checkLicenses = !watch || watchFull;
+let useTerser = buildFull;
+let useBabel = buildFull;
+let checkLicenses = buildFull;
 
 switch (build) {
   case 'local':
-- 
GitLab