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