karma-runner / karma-chrome-launcher

A Karma plugin. Launcher for Chrome and Chrome Canary.
MIT License
469 stars 119 forks source link

Karma fails to capture Chrome v93 (but OK with Chrome Headless) #234

Open craigfowler opened 3 years ago

craigfowler commented 3 years ago

Not so much a Karma bug but an issue I imagine others will search for. I figure it's worth reporting it here so that others may find both the problem and workaround together. I have also posted this on StackOverflow with further detail.

I have recently found that following an auto-update to Chrome v93 on our CI build agents, Karma has begun failing to capture Chrome and eventually gives up. In our karma.conf.js file, we were previously using browsers: ['Chrome'].

We have worked around this (and our builds succeed again) by switching to browsers: ['ChromeHeadless'] in our Karma config.

There might also be some kind of issue with Chrome itself which needs fixing, but for those who can manage with ChromeHeadless instead of full Chrome, the workaround should get things going again.

chekit commented 3 years ago

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',
                ]
            }
        },
    });
}       

P.S. Added the same comment on StackOverflow