skia2/modules/canvaskit/karma.bench.conf.js
Kevin Lubick 371967f791 [canvaskit] Update Chrome version and use npm ci for tests
By using npm ci, we can make sure the versions of the helper
libraries (e.g. Karma, Jasmine) we are testing with locally
is the same as the versions we are using in the continuous
integration system.

The copying is needed because our docker recipe forces us
to run as not root, and this was causing some issues. As a
result, I changed the canvaskit test/perf to not re-use the
same file as pathkit does so copying was easier and the
dependencies between the two modules is broken.

Bug: skia:11077
Change-Id: Ib05890d666d3507d4f724a4ae298484629c7932a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343503
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-12-14 15:03:42 +00:00

99 lines
3.0 KiB
JavaScript

const isDocker = require('is-docker')();
module.exports = function(config) {
// Set the default values to be what are needed when testing the
// WebAssembly build locally.
let cfg = {
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
{ pattern: 'canvaskit/bin/canvaskit.wasm', included:false, served:true},
{ pattern: 'perf/assets/*', included:false, served:true},
'perf/perfReporter.js',
'canvaskit/bin/canvaskit.js',
'tests/canvaskitinit.js',
'tests/util.js',
'perf/*.bench.js'
],
proxies: {
'/canvaskit/': '/base/canvaskit/bin/',
'/assets/': '/base/perf/assets/'
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],
// web server port
port: 4444,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
browserDisconnectTimeout: 20000,
browserNoActivityTimeout: 20000,
// start these browsers
browsers: ['Chrome'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity,
};
if (isDocker) {
// See https://hackernoon.com/running-karma-tests-with-headless-chrome-inside-docker-ae4aceb06ed3
cfg.browsers = ['ChromeHeadlessNoSandbox'],
cfg.customLaunchers = {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: [
// Without this flag, we see an error:
// Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
'--no-sandbox',
// may help tests be less flaky
// https://peter.sh/experiments/chromium-command-line-switches/#browser-test
'--browser-test',
// This can also help avoid crashes/timeouts:
// https://github.com/GoogleChrome/puppeteer/issues/1834
'--disable-dev-shm-usage',
],
},
};
}
if (process.env.ASM_JS) {
console.log('asm.js is under test');
cfg.files = [
{ pattern: 'npm-asmjs/bin/pathkit.js.mem', included:false, served:true},
'perf/perfReporter.js',
'npm-asmjs/bin/pathkit.js',
'perf/*.bench.js'
];
cfg.proxies = {
'/pathkit/': '/base/npm-asmjs/bin/'
};
} else {
console.log('wasm is under test');
}
config.set(cfg);
}