diff options
-rw-r--r-- | .gitlab-ci.yml | 3 | ||||
-rw-r--r-- | config/karma.config.js | 23 |
2 files changed, 20 insertions, 6 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8a69757411f..8e694e4aad4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -448,13 +448,16 @@ karma: <<: *except-docs variables: BABEL_ENV: "coverage" + DEBUG: "true" script: - bundle exec rake karma coverage: '/^Statements *: (\d+\.\d+%)/' artifacts: name: coverage-javascript expire_in: 31d + when: always paths: + - chrome_debug.log - coverage-javascript/ coverage: diff --git a/config/karma.config.js b/config/karma.config.js index ecbd7d4e3e8..978850e5d70 100644 --- a/config/karma.config.js +++ b/config/karma.config.js @@ -21,14 +21,16 @@ module.exports = function(config) { var karmaConfig = { basePath: ROOT_PATH, - browsers: ['ChromeHeadlessNoSandbox'], + browsers: ['ChromeHeadlessCustom'], customLaunchers: { - ChromeHeadlessNoSandbox: { + ChromeHeadlessCustom: { base: 'ChromeHeadless', - // chrome cannot run in sandboxed mode inside a docker container unless it is run with - // escalated kernel privileges: docker run --cap-add=CAP_SYS_ADMIN - flags: ['--no-sandbox'], - displayName: 'Chrome' + displayName: 'Chrome', + flags: [ + // chrome cannot run in sandboxed mode inside a docker container unless it is run with + // escalated kernel privileges (e.g. docker run --cap-add=CAP_SYS_ADMIN) + '--no-sandbox', + ], } }, frameworks: ['jasmine'], @@ -54,5 +56,14 @@ module.exports = function(config) { }; } + if (process.env.DEBUG) { + karmaConfig.logLevel = config.LOG_DEBUG; + process.env.CHROME_LOG_FILE = process.env.CHROME_LOG_FILE || 'chrome_debug.log'; + } + + if (process.env.CHROME_LOG_FILE) { + karmaConfig.customLaunchers.ChromeHeadlessCustom.flags.push('--enable-logging', '--v=1'); + } + config.set(karmaConfig); }; |