Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Karma opens three times in Chrome. Karma Bug?

For some reason, Karma tries three times to open Chrome, and thinks it's unsuccessful. It works fine once it loads, and shows that it connects on two sockets.

I have Chrome installed in a different location than Karma defaults to, so I had to link to the absolute path of Chrome. I suspect this may have something to do with why it doesn't "see" that Chrome is running. Is this a bug or is there something I can do to fix this?

Here is my config:

module.exports = function(config) {
config.set({

// base path, that will be used to resolve files and exclude
basePath: '',


// frameworks to use
frameworks: ['jasmine'],


// list of files / patterns to load in the browser
files: [
    '../../Scripts/angular.js',
    '../../Scripts/angular-*.js',
    '*.spec.js',
    '*.js'
],


// list of files to exclude
exclude: [
  '../../Scripts/angular-scenario.js',
],


// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
reporters: ['progress'],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,

// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: ["C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"],

// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,

// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false
});
};
like image 737
RyanJMcGowan Avatar asked Nov 25 '13 07:11

RyanJMcGowan


1 Answers

For me, closing the browser window by pressing the X button would cause this issue to occur. There is a flag called retryLimit which is set to 2 by default, see http://karma-runner.github.io/2.0/config/configuration-file.html.

If you set that to zero, by adding the line

retryLimit : 0,

somewhere in your config.set structure, the browser doesn't pop up after you close it. Though, the fact that that flag exists makes me think that you are normally supposed to close karma by some other means...

like image 144
Alex Li Avatar answered Oct 15 '22 12:10

Alex Li