PhatomJS crashes when running unit tests using Karma

I use Karma to run unit tests using the Jasmine and PhantomJS frameworks. The problem is that PhantomJS does not free memory properly, and when it exceeds 1 GB, then it crashes. This is probably the same or very similar case as described here PhantomJs crash while working with test examples of grunt-karma ???? /

Based on https://github.com/ariya/phantomjs/blob/master/src/webpage.cpp I see that there is void WebPage :: clearMemoryCache () .

Any idea how to run clearMemoryCache after starting each describe in the test?

I found that node_modules \ karma-phantomjs-launcher \ index.js has a self.specSuccess method , where I can get PhantomJS to clear the memory. However, I cannot find an instance of PhantomJS and even then how to execute WebPage :: clearMemoryCache () .

+4
source share

All Articles