The Karma test suite fails with the message:
Disconnected, because no message in 10000 ms.
No tests are executed at all.
"@angular/core": "7.1.3",
"jasmine-core": "3.3.0",
"karma-jasmine": "1.1.2",
There is no apparent reason for the failure, it just started after a new test was introduced.
I had the same problem and tried everything - nothing works except adding this option to my karma.conf.js
:
browserNoActivityTimeout: 400000
When the --module
compiler option for TypeScript in tsconfig.spec.json
is set to commonjs
Karma fails internally before any tests are executed and shows the timeout error above.
The import ordering can let Karma fail:
import CustomerTypeEnum = CustomerDto.CustomerTypeEnum;
import {CustomerDto} from '../api/CustomerDto';
While this order works as expected:
import {CustomerDto} from '../api/CustomerDto';
import CustomerTypeEnum = CustomerDto.CustomerTypeEnum;
The problem can also be fixed by changing the module compiler option to e.g. es2015
.
I had a similar problem on Chrome 85.0.4183. I don't know why Karma lose connection with browser and I get "Disconnected, because of no message in 30000 ms."
I've add this to Karma.conf:
captureTimeout: 210000,
browserDisconnectTolerance: 3,
browserDisconnectTimeout : 210000,
browserNoActivityTimeout : 210000
now it works, hope this will help you
It failed for me because I was setting window.location.href in my component, but the test run just hung at random times rather than failing in the test for my component.
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