Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Karma is not able to run test cases on phantomJS #558

Closed
kausikram opened this issue May 28, 2013 · 105 comments
Closed

Karma is not able to run test cases on phantomJS #558

kausikram opened this issue May 28, 2013 · 105 comments

Comments

@kausikram
Copy link

I have been trying to get Karma to run tests on PhantomJS for the last couple of hours and seem to be stuck at it. I had my entire suit run tests in Chrome and it ran without a quirk. on trying to run it with Karma, it would just not run.

I was running phantomjs 1.9 and then i reverted to 1.8. i tried installing it from the distributed binary from the phantomjs site and i also tried to install it through npm. But i had no avail in any of the combinations. I am on a 64bit Ubuntu machine.

I am pretty sure my configurations are correct and i checked phantomjs which again seems to be working.

Am i missing something here. or is this some bizarre bug.

I am attaching my debug logs below.

DEBUG [reporter]: Using reporter "dots".
DEBUG [reporter]: Using reporter "junit".
INFO [karma]: Karma server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
DEBUG [launcher]: Creating temp dir at /tmp/testacular-86450027
DEBUG [launcher]: phantomjs /tmp/testacular-86450027/capture.js
DEBUG [watcher]: Resolved files:
    /home/kausikram/lib/node_modules/karma/adapter/lib/jasmine.js
    /home/kausikram/lib/node_modules/karma/adapter/jasmine.js
    /home/kausikram/Projects/scloud/src/main/webapp/resources/jquery/jquery.js
    /home/kausikram/Projects/scloud/src/main/webapp/resources/jquery/jquery.dynoform.js
[...]

DEBUG [web server]: serving: /home/kausikram/lib/node_modules/karma/static/client.html
DEBUG [web server]: serving: /home/kausikram/lib/node_modules/karma/static/testacular.js
DEBUG [karma]: New browser has connected on socket s2jUXmnylvNYdQux4Wc2
WARN [launcher]: PhantomJS have not captured in 60000 ms, killing.
DEBUG [launcher]: Process PhantomJS exitted with code 1
ERROR [launcher]: Cannot start PhantomJS

DEBUG [launcher]: Cleaning temp dir /tmp/testacular-86450027
INFO [launcher]: Trying to start PhantomJS again.
DEBUG [launcher]: Creating temp dir at /tmp/testacular-86450027
DEBUG [launcher]: phantomjs /tmp/testacular-86450027/capture.js
DEBUG [web server]: serving: /home/kausikram/lib/node_modules/karma/static/client.html
DEBUG [web server]: serving: /home/kausikram/lib/node_modules/karma/static/testacular.js
DEBUG [karma]: New browser has connected on socket 3qsGGwLPK5ogNJs_4Wc3
WARN [launcher]: PhantomJS have not captured in 60000 ms, killing.
DEBUG [launcher]: Process PhantomJS exitted with code 1
ERROR [launcher]: Cannot start PhantomJS
@alejandroiglesias
Copy link

Same for me, worked fine yesterday at office. Should check karma version there.

@ajwdev
Copy link

ajwdev commented May 28, 2013

Just ran into this issue this morning when I updated NodeJS. My Karma version is 0.8.5

When using version 0.8.17 of Node (was my previous version) I have no problems.

$ /usr/local/Cellar/node/0.8.17/bin/node /usr/local/share/npm/bin/karma start config/karma-e2e.conf.js --single-run
[2013-05-28 16:17:45.646] [WARN] config - "/" is proxied, you should probably change urlRoot to avoid conflicts
INFO [karma]: Karma server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9 (Mac)]: Connected on socket id urr1wY_BZSgaAqdCAP8-
PhantomJS 1.9 (Mac): Executed 6 of 6 SUCCESS (4.322 secs / 4.179 secs)

Here is an example of it failing with debug logging using NodeJS version 0.10.8

$ /usr/local/share/npm/bin/karma start config/karma-e2e.conf.js --single-run --log-level debug
[2013-05-28 16:18:41.145] [WARN] config - "/" is proxied, you should probably change urlRoot to avoid conflicts
DEBUG [reporter]: Using reporter "progress".
INFO [karma]: Karma server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
DEBUG [launcher]: Creating temp dir at /var/folders/mr/y8bcv90j3gsf7_g3hxknvkrr0000gn/T/testacular-85137315
DEBUG [launcher]: /usr/local/bin/phantomjs /var/folders/mr/y8bcv90j3gsf7_g3hxknvkrr0000gn/T/testacular-85137315/capture.js
DEBUG [watcher]: Resolved files:
    /usr/local/share/npm/lib/node_modules/karma/adapter/lib/angular-scenario.js
    /usr/local/share/npm/lib/node_modules/karma/adapter/angular-scenario.js
    /Users/andrew/source/intoxitrack-service/intoxitrack-webclient/test/e2e/scenarios.js
DEBUG [web server]: serving: /usr/local/share/npm/lib/node_modules/karma/static/client.html
DEBUG [web server]: serving: /usr/local/share/npm/lib/node_modules/karma/static/testacular.js
DEBUG [karma]: New browser has connected on socket cuwbw9kc5C4r2myDAdgL
WARN [launcher]: PhantomJS have not captured in 60000 ms, killing.
DEBUG [launcher]: Process PhantomJS exitted with code 0
DEBUG [launcher]: Cleaning temp dir /var/folders/mr/y8bcv90j3gsf7_g3hxknvkrr0000gn/T/testacular-85137315
INFO [launcher]: Trying to start PhantomJS again.
DEBUG [launcher]: Creating temp dir at /var/folders/mr/y8bcv90j3gsf7_g3hxknvkrr0000gn/T/testacular-85137315
DEBUG [launcher]: /usr/local/bin/phantomjs /var/folders/mr/y8bcv90j3gsf7_g3hxknvkrr0000gn/T/testacular-85137315/capture.js
DEBUG [web server]: serving: /usr/local/share/npm/lib/node_modules/karma/static/client.html
DEBUG [web server]: serving: /usr/local/share/npm/lib/node_modules/karma/static/testacular.js
DEBUG [karma]: New browser has connected on socket 47DqLLB9K9vfQSmXAdgM
WARN [launcher]: PhantomJS have not captured in 60000 ms, killing.
DEBUG [launcher]: Process PhantomJS exitted with code 0
DEBUG [launcher]: Cleaning temp dir /var/folders/mr/y8bcv90j3gsf7_g3hxknvkrr0000gn/T/testacular-85137315
INFO [launcher]: Trying to start PhantomJS again.
DEBUG [launcher]: Creating temp dir at /var/folders/mr/y8bcv90j3gsf7_g3hxknvkrr0000gn/T/testacular-85137315
DEBUG [launcher]: /usr/local/bin/phantomjs /var/folders/mr/y8bcv90j3gsf7_g3hxknvkrr0000gn/T/testacular-85137315/capture.js
WARN [cuwbw9kc5C4r2myDAdgL]: Disconnected
DEBUG [web server]: serving: /usr/local/share/npm/lib/node_modules/karma/static/client.html
DEBUG [web server]: serving: /usr/local/share/npm/lib/node_modules/karma/static/testacular.js
DEBUG [karma]: New browser has connected on socket fdGB70jw8aW55CXIAdgN
WARN [launcher]: PhantomJS have not captured in 60000 ms, killing.
DEBUG [launcher]: Process PhantomJS exitted with code 0
DEBUG [karma]: PhantomJS failed to capture, aborting the run.
DEBUG [launcher]: Disconnecting all browsers
DEBUG [launcher]: Killing PhantomJS
DEBUG [launcher]: Cleaning temp dir /var/folders/mr/y8bcv90j3gsf7_g3hxknvkrr0000gn/T/testacular-85137315

This works fine with Firefox and Chrome as the browsers.

Is there anything else I can provide for further debugging?

EDIT: It appears it also works fine with NodeJS version 0.10.4 so somewhere between 0.10.4 and 0.10.8 it breaks.

@alejandroiglesias
Copy link

@TheDude05 you're right, i also updated to 0.10.8 today. Node 0.10.7 had a serious bug on NPM (isaacs/npm#3443), so didn't tested with it, but i'm sure it works on 0.10.6, which is the version i had yesterday working at my office.

Meanwhile, here is Node 0.10.6.

@pschneider-manzell
Copy link

Same for me. Upgraded from node 0.10.7 to 0.10.8 (Ubuntu 12.04.2 LTS)
With this node version karma could not connect to phantomJS anymore.

@ajwdev
Copy link

ajwdev commented May 29, 2013

Confirmed that it works fine with Node 0.10.7. It appears the latest 0.10.8 is the only version that causes problems

@michaeltaranto
Copy link

Yeah we upgraded to 0.10.8 and have the same problem.

@uggedal
Copy link

uggedal commented May 30, 2013

This is the cause of breakage on 0.10.8/9: socketio/socket.io#1242 (comment)

@uggedal
Copy link

uggedal commented May 30, 2013

A quick fix is to change to the xhr-polling transport here: https://github.com/karma-runner/karma/blob/master/lib/server.js#L43

Ideally karma should expose the socket.io transport through user configuration. Or just switch to sockjs which uses a saner websocket parser through faye-websocket.

@rburhum
Copy link

rburhum commented Jun 1, 2013

I can confirm it doesn't work in 0.10.9. Since I am in OSX, I used this to move to 0.10.6: http://andrestorres.me/Programming/2012/04/27/switching-between-node-versions-with-brew/

@chicoxyzzy
Copy link

Same issue. Ubuntu 12.04, nodejs 0.10.9, karma 0.8.5

@jribble
Copy link

jribble commented Jun 4, 2013

Same issue. I temporarily resolved it using uggedal's suggestion - I removed 'websocket' from the list of acceptable transports in https://github.com/karma-runner/karma/blob/master/lib/server.js#L43

@vvakame
Copy link

vvakame commented Jun 5, 2013

👍
Same issue. Mac OS X 10.8.3, nodejs 0.10.8, 0.10.9, 0.10.10, karma 0.8.5

@hozn
Copy link

hozn commented Jun 5, 2013

Confirmed this still seems to be broken in 0.10.10 (despite the above-linked socket.io issue having been fixed in 0.10.10?). The workaround (removing 'webdriver') does work.

@NickHeiner
Copy link

👍 same issue

Mac OS X 10.8.3
Node 0.10.8
Karma 0.8.5

Downgrading to node 0.10.6 solved the problem:

$ n 0.10.6

     install : 0.10.6
       mkdir : /usr/local/n/versions/0.10.6
       fetch : http://nodejs.org/dist/v0.10.6/node-v0.10.6-darwin-x64.tar.gz
   installed : v0.10.6

$ karma --version
Karma version: 0.8.5

$ karma start test/karma.conf.js 
INFO [karma]: Karma server started at http://localhost:8000/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9 (Mac)]: Connected on socket id bGzthlS_75Etm9K4Juea
PhantomJS 1.9 (Mac): Executed 35 of 35 SUCCESS (0.936 secs / 0.874 secs)

@abanctelchevrel
Copy link

👍
Same issue . Debian 7.0 (wheezy) , node 0.10.10, karma 0.8.5

@agarie
Copy link

agarie commented Jun 10, 2013

Same issue: Ubuntu 12.04, node 0.10.10 and karma 0.8.5.

@wcamarao
Copy link

Same issue: OSX 10.8, works on node 0.10.7 but not on 0.10.8

@aeife
Copy link

aeife commented Jun 12, 2013

Same issue: Linux Mint 15, node 0.10.10, karma 0.8.5

@tcrosen
Copy link

tcrosen commented Jun 12, 2013

Same issue, workaround specified above does not work for me.

Windows 7 x64
Node 0.10.10
Karma 0.8.5

@ernestoalejo
Copy link

@tcrosen Downgrade to Node 0.8 by the moment, at least works there

@rbdone
Copy link

rbdone commented Jun 12, 2013

Same issue, and workaround is not working (unable to downgrade node).
CentOS 6.4
Node 0.10.10
Karma 0.8.5

@jmdobry
Copy link

jmdobry commented Jun 12, 2013

This is now a major issue at work, putting our continued use of Karma in jeopardy.

@tcrosen
Copy link

tcrosen commented Jun 12, 2013

@ernestokarim easier to just run in Chrome and deal with an extra browser window until this is fixed.

@jmdobry
Copy link

jmdobry commented Jun 12, 2013

@tcrosen That's fine for my dev machine, but our build servers are headless—no browsers but phantomjs.

@PredatorVI
Copy link

Any idea if/when this might get addressed so that no patching/work arounds/downgrades/etc. are no longer required? Had hoped 0.10.10 would have taken care of it, but we are still seeing it.

@uggedal
Copy link

uggedal commented Jun 12, 2013

As per my previous comment: the bug is in socket.io. Not Karma nor Node.js.

@abanctelchevrel
Copy link

@rbdone did you try to downgrade using NVM ?

@rbarreca
Copy link

So supposedly this is fixed in Node 0.10.10 but it was still busted for me after upgrading node. I tried upgrading socket.io to 0.9.15 but doesn't seem like that does it either.

Removing 'websocket' from server.js fixes it for me, but I'd love to see karma@canary + karma-phantomjs-launcher work in the npm version. Any ideas?

$ node --version
v0.10.10
$ ./node_modules/.bin/karma --version
Karma version: 0.9.2

@rbarreca
Copy link

@uggedal I have the start of a Pull Request to make socketTransports configurable at #573. I don't think it's the right fix necessarily, but seems like you thought it useful. Mind giving feedback there?

@Deepakdubey90
Copy link

Hi,
i' am writing unit Test-Case for UI by using PhantomJs with Karma(angularJs) . but got an error on console .
Error >>>>>>>>>>>>>>>>>
PhantomJS 1.9.8 (Linux): Executed 36 of 39 SUCCESS (0 secs / 0.104 secs)
PhantomJS 1.9.8 (Linux) ERROR
""Some of your tests did a full page reload!""
PhantomJS 1.9.8 (Linux): Executed 36 of 39 ERROR (0.141 secs / 0.104 secs)
npm ERR! Test failed. See above for more details.
Error>>>>>>>>>>>>>>>>>

i'm not able execute all of the test case because of this error(skip few of the test case while executing.) how to debug this error
""Some of your tests did a full page reload!"".
Please suggest me to fix this issue.

@Deepakdubey90
Copy link

Hey, guys how can i debug the jasmine unit test case to trace error..
PhantomJS 1.9.8 (Linux 0.0.0) ERROR
Some of your tests did a full page reload!
PhantomJS 1.9.8 (Linux 0.0.0): Executed 36 of 153 ERROR (0.15 secs / 0.112 secs)

Please suggest me the root cause of this.

@joseph-jja
Copy link

One scenario I have found that is reproducable is when a developer checks in a file that depends on a file that is not checked into source. The tests fail when they try to find that file. So in terms of AMD / requirejs:

moduleA.js would have this:
define(['moduleB'], function(b) { console.log(b); });

then a test would define(['moduleA'], function(a) { describe .. jasmine test stuff....

moduleB does not exist so then error

Running "karma:common" (karma) task�
INFO [karma]: �Karma v0.12.35 server started at http://localhost:37117/
INFO [launcher]: �Starting browser PhantomJS
INFO [PhantomJS 1.9.8 (Linux 0.0.0)]: �Connected on socket H6Mhb7BTo19vIi_awUzY with id 84202369
PhantomJS 1.9.8 (Linux 0.0.0) LOG: 'Test port: 37117'

WARN [web-server]: �404: /base/src/moduleB.js
PhantomJS 1.9.8 (Linux 0.0.0) ERROR: 'There is no timestamp for /base/src/moduleB.js!'

WARN [PhantomJS 1.9.8 (Linux 0.0.0)]: �Disconnected (1 times), because no message in 10000 ms.

@VikrantGodse
Copy link

Hey Hi....I have also faced the same issue...just anywhere in your test cases you might have used "SpyOn(window, 'location')" and immediate after that u have not called any jasmine matcher like "toHaveBeenCalled" that results into reloading issue.....also check that all dependencies are spelled and injected properly....I am sure you'll get the solution...!

@Deepakdubey90
Copy link

@VikrantGodse thanks, its working.

@marcofranssen
Copy link

Same issue here...

Node: 4.2.2
Karma 0.13.15
Karma-phantomjs-launcher 0.2.1
phantomjs 1.9.18

This is how we run it

karma start "web/js2/test/karma.conf.js" --no-colors --single-run --log-level info --reporters dots
19 11 2015 15:22:07.682:INFO [karma]: Karma v0.13.15 server started at http://localhost:9877/
19 11 2015 15:22:07.695:INFO [launcher]: Starting browser PhantomJS
19 11 2015 15:22:27.706:WARN [launcher]: PhantomJS have not captured in 20000 ms, killing.
19 11 2015 15:22:27.722:INFO [launcher]: Trying to start PhantomJS again (1/2).
19 11 2015 15:22:47.729:WARN [launcher]: PhantomJS have not captured in 20000 ms, killing.
19 11 2015 15:22:47.739:INFO [launcher]: Trying to start PhantomJS again (2/2).
19 11 2015 15:23:07.743:WARN [launcher]: PhantomJS have not captured in 20000 ms, killing.
19 11 2015 15:23:07.749:ERROR [launcher]: PhantomJS failed 2 times (timeout). Giving up.

Also tried with longer timeouts of 2 minutes, but it just doesn't work.

Running phantomjs manually like this seems to work since it just gives me the phantomjs REPL.

node_modules/phantomjs/bin/phantomjs
phantomjs> 

@KenNgo
Copy link

KenNgo commented Nov 20, 2015

I got an issue with phantomjs/ karmajs:

INFO [karma]: Karma v0.12.37 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
WARN [launcher]: PhantomJS have not captured in 60000 ms, killing.
INFO [launcher]: Trying to start PhantomJS again (1/2).
WARN [launcher]: PhantomJS have not captured in 60000 ms, killing.
INFO [launcher]: Trying to start PhantomJS again (2/2).
WARN [launcher]: PhantomJS have not captured in 60000 ms, killing.
ERROR [launcher]: PhantomJS failed 2 times (timeout). Giving up.
[16:14:42] 'test' errored after 3.05 min
[16:14:42] Error: 1

node --version v0.12.7
Karma v0.12.37
Karma-phantomjs-launcher 0.2.0
phantomjs 1.9.18

@maxm450
Copy link

maxm450 commented Dec 3, 2015

Same here

03 12 2015 14:56:09.385:WARN [karma]: No captured browser, open http://localhost:9876/
03 12 2015 14:56:09.405:INFO [karma]: Karma v0.13.15 server started at http://localhost:9876/
03 12 2015 14:56:09.409:INFO [launcher]: Starting browser PhantomJS
03 12 2015 14:56:10.886:ERROR [launcher]: Cannot start PhantomJS

03 12 2015 14:56:11.005:INFO [launcher]: Trying to start PhantomJS again (1/2).
03 12 2015 14:56:12.349:ERROR [launcher]: Cannot start PhantomJS

03 12 2015 14:56:12.387:INFO [launcher]: Trying to start PhantomJS again (2/2).
03 12 2015 14:56:13.369:ERROR [launcher]: Cannot start PhantomJS

03 12 2015 14:56:13.371:ERROR [launcher]: PhantomJS failed 2 times (cannot start). Giving up.

Karma v0.13.10
Karma-phantomjs-launcher 0.2.1
phantomjs 1.9.18

@joseph-jja
Copy link

I have tried adding lots of options to this and found that when phantomjs does this it is a problem in the code. Unfortunately finding out where is a bit more difficult, you have to set the logLevel to config.DEBUG and then run in verbose debugging mode. It usually spits out more info there.

I recommend running jshint / jslint or eslint on both your code AND your tests and looking for any undefined variables or other syntax errors. Things like extra commas and missing semicolons can cause issues in phantomjs/karma. Make sure any async code is coded correctly.

Lastly, make sure you do not have an it with no expects in it if you are using jasmine. We found that to be problematic. Ultimately though one of the tests is bad.

@niemyjski
Copy link

I recently started running into this issue as well: https://ci.appveyor.com/project/Exceptionless/exceptionless-ui/build/2.2.625

aquincum added a commit to aquincum/experigenserver2 that referenced this issue Jan 20, 2016
@karthikorsu
Copy link

How to configure karma_start.js to disable web security and local to remote url access using phantom launcher?

@MakkaHareesh
Copy link

hareesh@hareesh-VPCEA12EN:~/Desktop/pstnwebapp/test$ gulp test
[09:34:24] Working directory changed to ~/Desktop/pstnwebapp
[09:34:25] Using gulpfile ~/Desktop/pstnwebapp/gulpfile.js
[09:34:25] Starting 'start:server:test'...
[09:34:25] Finished 'start:server:test' after 146 ms
[09:34:25] Starting 'test'...
[09:34:26] Server started http://localhost:9001
[09:34:26] LiveReload started on port 35729
[09:34:26] Starting Karma server...
WARN start method is deprecated since 0.13. It will be removed in 0.14. Please use
server = new Server(config, [done])
server.start()
instead.
12 03 2016 09:34:28.014:ERROR [config]: File /home/hareesh/Desktop/pstnwebapp/karma.conf.js does not exist!
[09:34:28] 'test' errored after 2.09 s
[09:34:28] Error in plugin 'gulp-karma'
karma exited with code 1

i ran yo generator & test with gulp i got above error please send solution

@jamesongamble
Copy link

So, i've been using ES6 in my code ( function arrows, const, and let) and it is those lines that karma actually breaks on. It looks like you need another preprocessor to transpile the ES6 before karma can run properly. This module will probably fix the errors for you.

https://github.com/babel/karma-babel-preprocessor

I'm in the process of installing now. Will update once that is finished. Also, setting "logLevel: config.DEBUG," in your karma.confg.js and running grunt test with a "-v" flag also helped me figure out what lines it was really breaking on.

UPDATE:

Everything works now, I got karma-babel-preprocessor to transpile my ES6 code before karma ran its tests. Also, double check that your test files are actually loaded as well in "files: [ ]". After I got the errors to subside, it took me a second to figure out why it kept running 0 of 0 tests.

@antonyh
Copy link

antonyh commented Sep 28, 2016

I solved this issue by deleting the node_modules folder and running npm install again - PhantomJS and Karma ran flawlessly following this cleanup.

PhantomJS 2.1.1 on Linux
Karma 1.2.0
Grunt 0.4.5

@allenhwkim
Copy link

I solved this issue by reinstalling node_modules

karma 
karma-chrome-launcher
karma-jasmine
karma-ng-html2js-preprocessor
karma-phantomjs-launcher
phantomjs

@dusterio
Copy link

@antonyh sounds awfully irrational though, sounds like Microsoft :( good software shouldn't magically fix itself upon restart or reinstall.

@ds009
Copy link

ds009 commented Nov 19, 2016

I tried to change config by increasing browserNoActivityTimeout and browserDisconnectTimeout,etc. but phantomjs disconnection errors were still there.

Then enable swap space worked, as this answer said: https://stackoverflow.com/a/32444643

shell script for automation

fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
bash -c 'echo "/swapfile none swap sw 0 0" >> /etc/fstab'

Wish it can save your time

@MarcinMilewski
Copy link

I've got weird problem: run single test iteration works, but in continous mode doesn't, that means after starting browser PhantomJS, last log is Connected on socket ... and any test don't run.

@ethaneron
Copy link

ethaneron commented Feb 9, 2017

Hello everyone, I ran into this same (frustrating) issue and discovered the problem was in the karma config. Since I was using gulp to run karma / PhantomJS. When I changed singleRun: false -> true it started working for me again:

var gulp = require('gulp');
var Server = require('karma').Server;

// Run test once and exit
gulp.task('test', function (done) {
    new Server({
        configFile: __dirname + '/karma.conf.js',
        singleRun: true
    }, done).start();
});

You can also change this parameter directly inside of the karma config as well:

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

@tiefling
Copy link

tiefling commented Apr 5, 2017

I've just hit this - works fine on my local machines but won't run on the Visual Studio Online CI server. It used to work fine but has recently just stopped...

2017-04-04T18:24:11.4691955Z [18:24:11] Starting 'karma-server'...
2017-04-04T18:24:22.7975588Z [32m04 04 2017 18:24:22.796:INFO [framework.browserify]: [39mbundle built
2017-04-04T18:24:22.8435587Z [32m04 04 2017 18:24:22.843:INFO [karma]: [39mKarma v1.5.0 server started at http://0.0.0.0:9876/
2017-04-04T18:24:22.8435587Z [32m04 04 2017 18:24:22.843:INFO [launcher]: [39mLaunching browser PhantomJS with unlimited concurrency
2017-04-04T18:24:22.8495591Z [32m04 04 2017 18:24:22.849:INFO [launcher]: [39mStarting browser PhantomJS
2017-04-04T18:25:22.8598561Z [33m04 04 2017 18:25:22.859:WARN [launcher]: [39mPhantomJS have not captured in 60000 ms, killing.
2017-04-04T18:25:24.8616444Z [33m04 04 2017 18:25:24.861:WARN [launcher]: [39mPhantomJS was not killed in 2000 ms, sending SIGKILL.
2017-04-04T18:25:26.8628686Z [33m04 04 2017 18:25:26.861:WARN [launcher]: [39mPhantomJS was not killed by SIGKILL in 2000 ms, continuing.

I've already looked at a similar article on SO in relation to TeamCity (http://stackoverflow.com/questions/40382241/teamcity-phantomjs-have-not-captured-in-60000-ms-killing) but none of the suggestions there helped me - If there is a version conflict of some kind I'm not sure what I can do about it as it is a cloud server.

To complicate matters, trying using Chrome and Firefox results in similar errors, so Karma won't seem to run at all.

My gulp task looks like this...

gulp.task("karma-server", ["js-build"], function (done) {
    new KarmaServer({
        configFile: __dirname + "/karma.conf.js",
        singleRun: true,
        autoWatch: false,
        browsers: ["PhantomJS"],
        reporters: ["junit"]
    },
    function() {
        gutil.log('Karma run complete');
        done();
        process.exit();
    }).start();
});

@tiefling
Copy link

tiefling commented Apr 6, 2017

I fixed this by fixing karma version at 1.3.0 (1.3.0 instead of ^1.3.0)

There must be a bug in 1.5.0, which it was using before on the CI server (my local copy is 1.3.0).
As this seems to be a general thread rather than a resolvable issue I've created a specific issue for the 1.5.0 problem #2647

@sgsasha
Copy link

sgsasha commented Dec 20, 2017

If someone facing this problem in angular/cli, I've fixed this problem by uncommenting this lines in polyfill.ts:
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/weak-map';
import 'core-js/es6/set';

@devoto13
Copy link
Collaborator

devoto13 commented May 19, 2020

This issue accumulated a lot of different problems and is not actionable now. It has not been active for 2.5 years and PhantomJS has been archived two years ago. If you still experience issues with PhantomJS consider migrating to Chrome Headless or Firefox Headless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests