Karma fails to capture Chrome v93 and times-out/gives up Karma fails to capture Chrome v93 and times-out/gives up google-chrome google-chrome

Karma fails to capture Chrome v93 and times-out/gives up


Whether or not there is a true bug in Google Chrome aside, we noticed that we could work around this problem by using ChromeHeadless instead of regular Chrome in our Karma config file. We made the following one-line change in our Karma config karma.conf.js and everything is working once again. I've included the whole file but really only the browsers: line is relevant.

We had no particular reason to be using full Chrome instead of Chrome Headless so that workaround is suitable for us indefinitely.

module.exports = function (config) {  config.set({    basePath: '',    frameworks: ['jasmine', '@angular-devkit/build-angular'],    plugins: [      require('karma-jasmine'),      require('karma-chrome-launcher'),      require('karma-jasmine-html-reporter'),      require('karma-coverage-istanbul-reporter'),      require('@angular-devkit/build-angular/plugins/karma')    ],    client:{      clearContext: false    },    coverageIstanbulReporter: {      dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],      fixWebpackSourcePaths: true    },    angularCli: {      environment: 'dev'    },    reporters: ['progress', 'kjhtml'],    port: 9876,    colors: true,    logLevel: config.LOG_INFO,    autoWatch: true,    browsers: ['ChromeHeadless'], // Previously this was 'Chrome'    singleRun: false  });


Actually we started to explore the same issue and the thing that helped was to start use of custom launcher with couple of flags.

Before our karma.conf.js contained the following settings:

module.exports = function (config) {    config.set({       ...       browsers: ['Chrome'],       ...       customLaunchers: {            ChromeHeadlessNoSandbox: {                base: 'ChromeHeadless',                flags: ['--no-sandbox']            }        },    });}       

Now it contains the following changes and tests are started to run again:

module.exports = function (config) {    config.set({       ...       browsers: ['ChromeNoSandbox'],       ...        customLaunchers: {            ChromeNoSandbox: {                base: 'Chrome',                flags: [                    '--no-sandbox',                ]            }        },    });}