Open NateRedding opened 10 years ago
This issue appears to be mostly environmental, but I don't know what the specific factors are. Initially, I thought it was lack of memory, but I have witnessed some test runs that ran poorly even when there should have been plenty of free physical memory. As best as I can tell, running Karma/PhantomJS when my IDE is running (IntelliJ) causes it to run extremely poorly.
Also seeing this with phantom karma-jasmin on a very fast box with almost 30 gigs of free ram. Chrome runs the tests in 30 seconds, Phantom in over 3 minutes.
Also seeing extreme slowdown in one of our projects. The slow down seems to happen when loading json fixtures or html templates from local file using ajax request. The ajax request is instant in chrome but a few seconds in phantom.
I suspect PhantomJS. I'm seeing equivalent behavior running Java Selenium tests with PhantomJS, Chrome, and Firefox.
My issue was solved. It was slow dns lookup when trying to lookup localhost. Make sure you have an entry for localhost pointing to 127.0.0.1 in your hosts file. This did not manifest itself while running the same tests under chrome, but did under phantom.
Not the problem for me, unless also having an entry for ::1 will trigger it.
I am getting the same problem. It looks that phantomjs is taking about a second per file to serve up (from a xhr request).
+1 for fixing :)
Could you try with phantomjs 2.0? I could imagine it being faster :)
@dtabuenc - thanks for posting; adding localhost to my hosts file solved the issue for me as well.
+1
+1 (hi @eudisd)
anyone still having this problem? It is still slow for me with 2.0 and seems to get slower with each test case.
Same here, we have different set ups and tried both PhantomJS 1 and 2. Don't know if it's a launcher or PhantomJS problem.
I have the same issue, especially slow because of how many files I am loading using SystemJS (all XHR).
+1
+1
+1
The solution is not to use karma, switch over to jest + webpack + React.
+1
How can we all be having this issue and no solution yet?
Karma + Webpack + Jasmine + PhantomJS
147 tests PhantomJS 4:31 Chrome: 0:13
I replaced PhantomJS by Nightmare thanks to this guy and after that many of my problems are gone. Also, take a loot at this recommendation: https://github.com/angular/protractor/blob/master/docs/browser-setup.md#setting-up-phantomjs
@andregs Thank you so much for your suggestion! I'd really like to understand why PhantomJS was running so slowly,
147 tests:
Yea - Just move away from Phantom :) seems to be the right answer
@patrickmichalina, there is no other options that runs in virtual memory. We are trying to avoid having to setup xvfb in our CI machine just for running our tests.
We are runnning out of options though since every now and then our tests will crash due to random phantomjs timeout š¢
@pedrotst I'm not sure why the better solution of headless chrome has not been mentioned yet. I don't know what this Nightmare nonsense is.
New launcher: https://github.com/karma-runner/karma/issues/2489
Example config: https://github.com/karma-runner/karma/issues/2603
I haven't tried headless chrome myself yet, but it looks promising.
https://github.com/karma-runner/karma-phantomjs-launcher/issues/30#issuecomment-289288417 -- nightmare just runs electron.
@andregs very thanks for that Nightmare suggestion - its a bit of workaround but a good one!
I am converting a set of about 561 unit tests that were previously running on JSTD to run on Karma 0.12.0 and PhantomJS 1.9.7. I'll freely admit that these unit tests are probably doing all sorts of crazy stuff and not cleaning up properly after themselves and such (I didn't write them).
The tests run pretty quick when using karma-chrome-launcher - ~23 seconds. When I switch that to karma-phantom-launcher, it takes ~20 minutes!
I saw a similar issue (about a year old) on the Karma issues page talking about a 10x slowdown mentioning tweaks such as removing console.log output (ie.
console.log = function() {}
) and such. I can shave off a couple of minutes if I remove that and also turn off reporting of slow tests.Thinking maybe this was an issue with PhantomJS, I found a shell script test runner to run my tests directly on PhantomJS. It is able to run them in a little under 2 minutes with no problem. So, this leads me to believe it must be a problem with karma-phantom-launcher.
Interestingly, when I was re-running the tests to get the numbers above, I somehow had one run where everything ran in about 2.5 minutes... not sure how that happened. I immediately re-ran it and it took 20+ minutes again.
My config: