karma-chrome-launcher icon indicating copy to clipboard operation
karma-chrome-launcher copied to clipboard

Chrome hangs on new start

Open AStoker opened this issue 8 years ago • 8 comments

When I start karma, it starts up a new Chrome instance (as expected). However, the Chrome instance hangs trying to load the page (eventually prompting me to either kill the tab or wait for it). Karma will time out and try to launch chrome again, before it eventually gives up and shuts down. However, I can copy the link that Karma is trying to open, and paste it in another instance of Chrome, and it loads up just fine.
So it seems that there is something wrong with how karma-chrome-launcher is starting up the Chrome instance.
Karma config:

// Karma configuration
// Generated on Tue Oct 13 2015 10:36:06 GMT-0400 (Eastern Daylight Time)

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

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: 'wwwroot',


    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['jspm','jasmine'],


    jspm: {
        loadFiles: [
            'src/**/*.js',
            'test/**/*.js'
        ],
        paths: {
            '*': '*.js'
        },
    },

    // list of files / patterns to load in the browser
    files: [
        'src/**/*.css'
    ],


    // list of files to exclude
    exclude: [
    ],


    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
        'src/**/*.js': ['babel']
    },
    'babelPreprocessor': {
        options: {
            sourceMap: 'inline',
            modules: 'system',
            moduleIds: false,
            //loose: "all",
            optional: [
              "es7.decorators",
              "es7.classProperties",
              "es7.asyncFunctions",
              "es7.functionBind",
            ]
        }
    },


    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    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
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['Chrome'],


    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false
  })
}

I don't think it's necessarily a problem with Karma, as I can use the Firefox launcher, and it works just fine. However, that could be coincidence...

AStoker avatar Nov 03 '15 15:11 AStoker

+1

ghost avatar Nov 04 '15 01:11 ghost

same issue no solution yet +1

VivekWisdom avatar Feb 16 '16 01:02 VivekWisdom

yep, my chrome instances open up immediately dead but using chrome stand alone is fine. Any attempt to interact with the "dead" instance of chrome results in dead tabs with the "sad mac" icon (e.g. opening extensions, settings, etc.)

image

oising avatar Mar 03 '16 20:03 oising

A little investigation tells me that the node process is launching chrome with a custom --user-data-dir path. When I try to launch chrome with the same command line, e.g.

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir=C:\Users\username\AppData\Local\Temp\karma-43519497 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate http://localhost:9876/?id=43519497

It crashes with the dead tab, although the data dir is populated with the various initialization data that the browsers dumps there.

When I omit the --user-data-dir statement, the browser instance does NOT crash.

oising avatar Mar 03 '16 20:03 oising

This happened to me when I was running the command from admin console. When running as current user it works.

vdolek avatar May 22 '17 11:05 vdolek

I'm having the same issue and it's not related to administrative permissions. Did the same test as @oising same results. As soon as the --user-data-dir flag is present, the tab is crashing. I expect it to be a Chome issue instead of Karma

nakah avatar Jul 21 '17 09:07 nakah

Yes, I am hitting the same issue but it is a chrome-launcher issue not a karma issue I think. I can repro just using https://github.com/GoogleChrome/lighthouse/tree/master/chrome-launcher.

mmanela avatar Aug 23 '17 16:08 mmanela

Posted on Chrome-Launcher (https://github.com/GoogleChrome/lighthouse/issues/3099)

mmanela avatar Aug 23 '17 16:08 mmanela