add DEBUG flag option to karma config

This commit is contained in:
Mike Greiling 2017-06-14 13:58:10 -05:00
parent d70be8f83c
commit 50b2b3f5f0
2 changed files with 20 additions and 6 deletions

View file

@ -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:

View file

@ -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);
};