Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Chrome 35 disconnect after running my Karma tests?

I have a Karma test suite that runs great in Firefox and Chrome 34. Chrome auto-upgraded to 35 and I'm getting this error after the tests have run:

WARN [Chrome 35.0.1916 (Mac OS X 10.9.2)]: Disconnected (1 times), because no message in 10000 ms.

Chrome 35.0.1916 (Mac OS X 10.9.2): Executed 712 of 712 DISCONNECTED (14.836 secs / 5.021 secs)

The tests all run and pass, but Chrome disconnecting causes the suite to fail.

We're running our tests from Grunt on OS X Mavericks.

Here's our config:

module.exports = function (config) {
  config.set({
    port: 9876,
    captureTimeout: 60000,
    frameworks: ['jasmine'],
    basePath: 'app/build',
    singleRun: true,
    browsers: [
      'Chrome',
      'Firefox'
    ],
    plugins: [
      'karma-jasmine',
      'karma-coverage',
      'karma-story-reporter',
      'karma-phantomjs-launcher',
      'karma-firefox-launcher',
      'karma-chrome-launcher'
    ],
    files: [
      // lots of files
    ],
    exclude: [
      '**/*.scenario.js'
    ],
    reporters: ['coverage', 'dots'],
    preprocessors: {
      '!(bower_components)/**/!(*.spec).js': 'coverage'
    },
    coverageReporter:  {
      type: 'cobertura',
      dir: '../coverage',
      file: 'coverage.xml'
    }
  });
};
like image 479
afternoon Avatar asked May 22 '14 10:05

afternoon


1 Answers

Please add a browserNoActivityTimeout in your karma.conf.js file. It is 10000 msec by default. I had a similar issue. Chrome seems to be taking some time to load and notify karma. I increased the timeout to 30000 and that solves it.

like image 129
sakadas Avatar answered Sep 19 '22 19:09

sakadas