1const isDocker = require('is-docker')(); 2 3module.exports = function(config) { 4 // Set the default values to be what are needed when testing the 5 // WebAssembly build locally. 6 let cfg = { 7 // frameworks to use 8 // available frameworks: https://npmjs.org/browse/keyword/karma-adapter 9 frameworks: ['jasmine'], 10 11 // list of files / patterns to load in the browser 12 files: [ 13 { pattern: 'debugger/bin/debugger.wasm', included:false, served:true}, 14 { pattern: 'debugger/sample.skp', included:false, served:true}, 15 { pattern: 'debugger/anim.mskp', included:false, served:true}, 16 '../../modules/pathkit/tests/testReporter.js', 17 'debugger/bin/debugger.js', 18 'tests/debuggerinit.js', 19 'tests/*.spec.js' 20 ], 21 22 proxies: { 23 '/debugger/': '/base/debugger/', 24 }, 25 26 // test results reporter to use 27 // possible values: 'dots', 'progress' 28 // available reporters: https://npmjs.org/browse/keyword/karma-reporter 29 reporters: ['progress'], 30 31 // web server port 32 port: 4444, 33 34 // enable / disable colors in the output (reporters and logs) 35 colors: true, 36 37 // level of logging 38 // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 39 logLevel: config.LOG_INFO, 40 41 // enable / disable watching file and executing tests whenever any file changes 42 autoWatch: true, 43 44 browserDisconnectTimeout: 15000, 45 browserNoActivityTimeout: 15000, 46 47 // start these browsers 48 browsers: ['Chrome'], 49 50 // Continuous Integration mode 51 // if true, Karma captures browsers, runs the tests and exits 52 singleRun: false, 53 54 // Concurrency level 55 // how many browser should be started simultaneous 56 concurrency: Infinity, 57 }; 58 59 if (isDocker) { 60 // See https://hackernoon.com/running-karma-tests-with-headless-chrome-inside-docker-ae4aceb06ed3 61 cfg.browsers = ['ChromeHeadlessNoSandbox'], 62 cfg.customLaunchers = { 63 ChromeHeadlessNoSandbox: { 64 base: 'ChromeHeadless', 65 flags: [ 66 // Without this flag, we see an error: 67 // Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted 68 '--no-sandbox' 69 ], 70 }, 71 }; 72 } 73 74 config.set(cfg); 75} 76