My tests recently started failing on TravisCI because Google apparently dropped support for Ubuntu 14.04 (Trusty) with the latest release of Chrome. I've upgraded to Ubuntu 16.04 (Xenial) but am now unable to get Karma to connect to Chrome:
11 09 2019 18:15:05.421:INFO [karma-server]: Karma v3.1.4 server started at http://0.0.0.0:9876/
11 09 2019 18:15:05.425:INFO [launcher]: Launching browsers Chrome_travis_ci with concurrency unlimited
11 09 2019 18:15:05.429:INFO [launcher]: Starting browser Chrome
11 09 2019 18:16:05.435:WARN [launcher]: Chrome have not captured in 60000 ms, killing.
11 09 2019 18:16:07.439:WARN [launcher]: Chrome was not killed in 2000 ms, sending SIGKILL.
11 09 2019 18:16:09.439:WARN [launcher]: Chrome was not killed by SIGKILL in 2000 ms, continuing.
It's unclear to me whether the issue is with my Travis config, my Karma config, or something else.
Solutions tried:
- Follow instructions for GUI and Headless Browser Testing on TravisCI
- Specify
xvfb-run
command in travis.yml (per this answer) - Add
--disable-setuid-sandbox
flag to karma.conf.js (per this comment)
travis.yml:
sudo: required
dist: xenial
services:
- xvfb
addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
language: node_js
node_js:
- "10"
- "8"
cache:
directories: node_modules
before_install:
- export CHROME_BIN=chromium-browser
before_script:
- npm rebuild node-sass
script:
- npm run lint
- npm run test:ci # Runs: xvfb-run -a karma start
- npm run build
karma.conf.js:
module.exports = (config) => {
config.set({
browsers: [process.env.TRAVIS ? 'Chrome_travis_ci' : 'Chrome'],
client: {
captureConsole: false,
},
customLaunchers: {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox', '--disable-setuid-sandbox'],
},
},
files: ['test/index.js'],
frameworks: ['mocha', 'chai'],
preprocessors: {
'test/index.js': ['webpack', 'sourcemap'],
},
reporters: ['dots'],
singleRun: true,
webpack: Object.assign(webpackConfigBase, {
devtool: 'inline-source-map',
mode: 'development',
}),
webpackServer: {
noInfo: true,
},
});
};
Any help or suggestions appreciated. Thanks!
Solution: Remove the
before_install
config from mytravis.yml
completely.After more searching I was finally tipped off to a possible solution by this comment:
Updating my
travis.yml
file fromto
solved the problem for me. I then went further and removed the command completely and everything still worked.