Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhantomJS2 disconnects after timeout - how to debug?

How would you debug this?

Running "karma:unit" (karma) task
INFO [karma]: Karma v0.12.37 server started at http://localhost:9126/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 2.0.0 (Mac OS X 0.0.0)]: Connected on socket inUICOZKKRvrMwaJulGW with id 93588533
WARN [PhantomJS 2.0.0 (Mac OS X 0.0.0)]: Disconnected (1 times), because no message in 10000 ms.

PhantomJS 2.0.0 (Mac OS X 0.0.0): Executed 0 of 0 DISCONNECTED (10.002 secs / 0 secs)

Warning: Task "karma:unit" failed. Use --force to continue.

Aborted due to warnings.

I got amongst others this in my karma.conf.js

phantomjsLauncher: {
  exitOnResourceError: true
},

browserNoActivityTimeout: 5000,

Switching to Chrome helps and makes the error go away. Phantom JS 2 is globally installed.

like image 847
stevek-pro Avatar asked Aug 11 '15 12:08

stevek-pro


1 Answers

You can modify the log level of Karma in karma.conf.js

 logLevel: config.LOG_DEBUG,

However, I have found this doesn't give any info around the error above. There is also a debug flag in customLaunchers, as shown here: https://github.com/karma-runner/karma-phantomjs-launcher

But that didn't solve it for me either.

I resolved this after realizing I was running a very recent, unstable version of Node.js (6.4). Migrating back to Node 4.6 resolved the error.

like image 152
Larry Turtis Avatar answered Oct 19 '22 18:10

Larry Turtis