From 7b5180c5dfb6546450b4a93e7dc500e74e5c564d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=20K=C3=A4sler?= <tom.kaesler@mni.thm.de>
Date: Fri, 8 Mar 2019 15:51:17 +0100
Subject: [PATCH] change to chrome with no-sandbox in docker environments

---
 .gitlab-ci.yml | 2 +-
 karma.conf.js  | 4 +++-
 package.json   | 1 +
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index eb847f994..db92e7a05 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -36,7 +36,7 @@ unit_tests:
   allow_failure: false
   dependencies: []
   variables:
-    CHROME_BIN: /usr/bin/chromium-browser
+    CHROME_BIN: /usr/bin/google-chrome
   script:
     - npm install
     - npm test
diff --git a/karma.conf.js b/karma.conf.js
index 123819772..99b6fe48b 100644
--- a/karma.conf.js
+++ b/karma.conf.js
@@ -1,6 +1,8 @@
 // Karma configuration file, see link for more information
 // https://karma-runner.github.io/1.0/config/configuration-file.html
 
+const isDocker = require('is-docker')();
+
 module.exports = function (config) {
   config.set({
     basePath: '',
@@ -8,7 +10,7 @@ module.exports = function (config) {
     customLaunchers: {
       ChromeHeadlessCustom: {
         base: 'ChromeHeadless',
-        flags: ['--no-sandbox']
+        flags: isDocker ? ['--no-sandbox'] : []
       }
     },
     frameworks: ['jasmine', '@angular-devkit/build-angular'],
diff --git a/package.json b/package.json
index dfd552448..f93b789e0 100644
--- a/package.json
+++ b/package.json
@@ -31,6 +31,7 @@
     "chart.js": "^2.7.3",
     "core-js": "^2.5.7",
     "hammerjs": "^2.0.8",
+    "is-docker": "^1.1.0",
     "ng2-charts": "^1.6.0",
     "ngx-markdown": "^1.6.0",
     "rxjs": "^6.3.3",
-- 
GitLab