I perform some unit-tests with Karma
, Sinon
and Mocha
. It was working fine and for one month, I have some issues running these unit-tests. I have an error with HeadlessChrome. Indeed, it shows this error:
HeadlessChrome 83.0.4103 (Windows 10.0.0) ERROR
Disconnected, because no message in 30000 ms.
I have this karma configuration:
module.exports = function (config) {
config.set({
// Others configs
...
port: 9876,
browsers: ['ChromeHeadlessNoSandbox'],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: [
'--no-sandbox', // required to run without privileges in docker
'--user-data-dir=/tmp/chrome-test-profile',
'--disable-web-security'
]
}
},
captureTimeout: 10000,
plugins: [
'karma-mocha', 'karma-mocha-reporter', 'karma-junit-reporter', 'karma-chrome-launcher',
'karma-typescript', 'karma-html-reporter'
]
});
};
I found two ways to fix it:
module.exports = function (config) {
config.set({
// Others configs
...
port: 9876,
browsers: ['Chrome'],
flags: [
'--no-sandbox', // required to run without privileges in docker
'--user-data-dir=/tmp/chrome-test-profile',
'--disable-web-security'
],
captureTimeout: 10000,
plugins: [
'karma-mocha', 'karma-mocha-reporter', 'karma-junit-reporter', 'karma-chrome-launcher',
'karma-typescript', 'karma-html-reporter'
]
});
};
How could I use ChromeHeadless again ? Indeed, it was nice because all unit-tests was running in background whereas now it opens the browsers, performs the tests and closes it.
We had the same surprise at my job. Our tests started to fail at the end of June which was a new Chrome 83 stable release.
They definitely broke something, you can follow-up here : https://bugs.chromium.org/p/chromium/issues/detail?id=1090988
EDIT:
So to answer properly, if you can go back to before Chrome 83, that will fix it for now. However, I don't know for our side of things, I would need to find a new docker image, which is not nice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With