Karma plugin freezes since 2018.3

Since upgrade of IntelliJ IDEA Ultimate to 2018.3 running Karma test freezes after capturing the browser. The following output is displayed in the Karma Server tab, ChromeHeadless being configured as the single browser for test execution:

10% building modules 1/1 modules 0 active13 12 2018 11:15:10.798:INFO [karma]: Karma v1.7.1 server started at http://0.0.0.0:9876/
13 12 2018 11:15:10.798:INFO [launcher]: Launching browser ChromeHeadless with unlimited concurrency
13 12 2018 11:15:10.798:INFO [launcher]: Starting browser Chrome
Waiting for a captured browser... To capture a browser open http://localhost:9876/
##intellij-event[browserConnected:{"id":"7861032","name":"HeadlessChrome 0.0.0 (Windows 10 0.0.0)","isAutoCaptured":true}]
13 12 2018 11:15:39.444:INFO [HeadlessChrome 0.0.0 (Windows 10 0.0.0)]: Connected on socket 0ao7m4pyYysrXQJlAAAA with id 7861032

In the Test Run tab "Waiting for browser capturing..." is displayed together with "To capture a browser open http://localhost:9876/". Opening the link manually in another browser finally causes the test execution to start, but the tests are then run in both ChromeHeadless and the browser where the link had been manually opened.

5 comments

Works fine for me. Please can you provide your karma.conf.js, package.json and screenshot of your run configuration? Sample project that shows up the issue would be also appreciated

0

I checked on a project freshly-generated using Angular CLI and indeed the Karma plugin works as desired there.

Here's karma.conf.js from he project where the issue occurs:

module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('karma-junit-reporter'),
require('@angular/cli/plugins/karma')
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
files: [
{ pattern: './src/test.ts', watched: false }
],
preprocessors: {
'./src/test.ts': ['@angular/cli']
},
mime: {
'text/x-typescript': ['ts','tsx']
},
coverageIstanbulReporter: {
reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
},
reporters: config.angularCli && config.angularCli.codeCoverage
? ['progress', 'junit', 'coverage-istanbul']
: ['progress', 'junit', 'kjhtml'],
junitReporter: {
outputDir: 'unit-test-reports'
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['ChromeHeadless'],
customLaunchers: {
"ChromeHeadless": {
base: 'Chrome',
flags: ['--headless', '--disable-gpu', '--remote-debugging-port=9222', '--no-sandbox']
}
},
singleRun: false,
browserNoActivityTimeout: 120000
});
};

I also tried with a karma.conf.js as generated by Angular CLI but without luck.

Here's the package.json:

{
"name": "xxx",
"version": "1.0.0-SNAPSHOT",
"scripts": {
"start": "ng serve",
"lint": "ng lint --type-check",
"test": "ng test --code-coverage true --single-run",
"build": "ng build -op dist/ --prod --aot",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/animations": "^4.0.0",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"bootstrap": "3.3.7",
"core-js": "^2.4.1",
"rxjs": "^5.5.2",
"web-animations-js": "^2.3.1",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "^1.3.2",
"@angular/compiler-cli": "^4.0.0",
"@types/chai": "4.1.2",
"@types/cucumber": "4.0.2",
"@types/jasmine": "2.5.53",
"@types/lodash": "^4.14.79",
"@types/node": "~6.0.60",
"@types/uuid": "^3.4.2",
"chai": "4.1.2",
"codelyzer": "~3.0.1",
"cucumber": "4.2.1",
"jasmine-core": "~2.9.1",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-junit-reporter": "^1.2.0",
"lodash": "^4.17.4",
"protractor": "5.3.0",
"protractor-cucumber-framework": "5.0.0",
"ts-node": "~3.1.0",
"tslint": "~5.3.2",
"typescript": "~2.3.4"
}
}

And the Karma run configuration:

0

Could you please try composing a sample project (based on your actual one) that can be used to recreate the issue? You can replace all your .ts/.html/.etc. files with a basic stuff cli generates, leaving the configuration (angular.json, package.json, tsconfig.*.json, karma config, etc.) intact

0

Please sign in to leave a comment.