Karma Disconnected, because no message in 10000 ms

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 the same problem and tried everything - nothing works except adding this option to my karma.conf.js:

browserNoActivityTimeout: 400000