1const path = require('path'); 2const fs = require('fs') 3// This should be a file created by gold_test_env.go which contains the port number 4// on which it is listening. For whatever reason, karma was not happy serving the 5// port file directly, but reading it in and then adding it as a proxy seems to 6// work fine. 7const testOnEnvPortPath = path.join(process.env['ENV_DIR'], 'port'); 8const port = fs.readFileSync(testOnEnvPortPath, 'utf8').toString(); 9console.log('test_on_env PORT:', port); 10 11module.exports = function(config) { 12 // http://karma-runner.github.io/6.3/config/configuration-file.html 13 let cfg = { 14 // available frameworks: https://npmjs.org/browse/keyword/karma-adapter 15 frameworks: ['jasmine'], 16 17 proxies: { 18 // The tests will make calls to /gold_rpc/whatever and they will be redirected 19 // to the correct location. 20 '/gold_rpc/': `http://localhost:${port}/`, 21 // This makes it more convenient for tests to load the test assets. 22 '/assets/': '/static/skia/modules/canvaskit/tests/assets/', 23 }, 24 25 // possible values: 'dots', 'progress' 26 // available reporters: https://npmjs.org/browse/keyword/karma-reporter 27 reporters: ['progress'], 28 colors: true, 29 logLevel: config.LOG_INFO, 30 31 browserDisconnectTimeout: 20000, 32 browserNoActivityTimeout: 20000, 33 34 // How many browsers should be started simultaneous 35 concurrency: Infinity, 36 }; 37 38 // Bazel will inject some code here to add/change the following items: 39 // - files 40 // - proxies 41 // - browsers 42 // - basePath 43 // - singleRun 44 // - plugins 45 BAZEL_APPLY_SETTINGS(cfg); 46 47 config.set(cfg); 48}; 49