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

Phantom hangs for a long time after all tests are finished with coverage #198

Closed
ghost opened this issue Mar 4, 2015 · 0 comments
Closed

Comments

@ghost
Copy link

ghost commented Mar 4, 2015

package.json => grunt-contrib-jasmine": "^0.8.2

We have a fairly large code base (dozens of kLocs) and using Jasmine for testing. After upgrading to Jasmine 2 and bumping up the version of grunt-contrib-jasmine, we see a peculiar behaviour when running tests with coverage using grunt-template-jasmine-istanbul.

All tests are finished in about 25 seconds followed by about 60-100 s when PhantomJS process spikes at 100% CPU and nothing seems to be happening. After that period, the coverage results are displayed.

Further investigation revealed that the coverage is tracked in a Javascript in-memory object and sent to PhantomJS through phantom.sendMessage on jasmineDone callback. The size of the in-memory object is huge, about 2 megabytes. This object is then passed to reporters/PhantomReporter.js, whose implementation of stringify is extremely inefficient for large objects.

Adding a snippet

if (obj[0] && obj[0] === 'jasmine.coverage') {return JSON.stringify(obj);}

into stringify function mitigates the issue. Of course, this is only a simple hotfix that works for us. A more generalized solution would be welcome.

amoilanen added a commit to amoilanen/grunt-contrib-jasmine that referenced this issue Nov 12, 2015
"Phantom hangs for a long time after all tests are finished with coverage"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant