question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Karma hangs while using phantomjs

See original GitHub issue

I am using:

node v0.10.19 karma v0.10.2 phantomjs v1.9.2

Here is the output I see, and it just seems to hang forever at this point:

INFO [karma]: Karma v0.10.2 server started at http://localhost:8080/
INFO [launcher]: Starting browser PhantomJS
DEBUG [karma]: A browser has connected on socket FBzwVXeAN0A4Z8uA4J-C
INFO [PhantomJS 1.9.2 (Linux)]: Connected on socket FBzwVXeAN0A4Z8uA4J-C

Here is my karma.conf file:

// Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html

module.exports = function(config) {
  config.set({
    // base path, that will be used to resolve files and exclude
    basePath: '',

    // testing framework to use (jasmine/mocha/qunit/...)
    frameworks: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      'app/bower_components/angular/angular.js',
      'app/bower_components/angular-mocks/angular-mocks.js',
      'app/bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
      'app/bower_components/angular-ui-ace/ui-ace.js',
      'app/scripts/*.js',
      'app/scripts/**/*.js',
      'test/mock/**/*.js',
      'test/spec/**/*.js'
    ],

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

    // web server port
    port: 8080,

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


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


    // Start these browsers, currently available:
    // - Chrome
    // - ChromeCanary
    // - Firefox
    // - Opera
    // - Safari (only Mac)
    // - PhantomJS
    // - IE (only Windows)
    browsers: ['PhantomJS'],


    // Continuous Integration mode
    // if true, it capture browsers, run tests and exit
    singleRun: false
  });
};

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
albulescucommented, Apr 6, 2016

You need to explicitly call process exit:

var srv = new KarmaServer({
        configFile: path.join(__dirname, '/../karma.conf.js'),
        singleRun: singleRun,
        autoWatch: !singleRun
    }, function(exitCode) {
        process.exit(exitCode); /// <-------- ADD THIS
        done(exitCode);
});
srv.start();
0reactions
manojkumarancommented, Feb 19, 2018

In my case setting autoWatch: true in karma conf fixed the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hanging on Jenkins - Google Groups
I'm running my karma job on Jenkins but it doesn't seem to respect singleRun:true. I've also tried passing the flag --single-run. In both...
Read more >
How to get around memory error with karma & phantomjs
It would appear as ERROR [launcher]: PhantomJS crashed. after the RAM for the process would exceed about 800-850 MB. There appears to be...
Read more >
Why Phantomjs got crashed while running more test cases?
1 Answer 1 ... PhantomJS notoriously has a lot of memory issues and will crash after a certain amount of memory use. I...
Read more >
Replacing PhantomJS and CasperJS with JSDOM and Chai ...
Over the last few months, we started experiencing very long build times (over 11 hours!) for our pipeline, specifically during the CasperJS/ ...
Read more >
SOLVED: Angular 6 CLI Karma Stuck in Single Run
SOLVED: Angular 6 CLI Karma Stuck in Single Run | Karma Stops Running ... I have already logged this issue with the CLI...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found