PhantomJs Crashes while running with grunt-karma test cases ????/

前端 未结 3 538
盖世英雄少女心
盖世英雄少女心 2021-01-26 01:32

We are facing an issue while running karma test cases with phantomJs our phantomJs crashes and gets disconnected. Is that due to memory leakage or some other issue.Kindly let

3条回答
  •  时光说笑
    2021-01-26 02:02

    There are two reasons I found that this can happen.

    1. PhantomJS does not release memory until its tab is closed so if your test suite is too large, you could be running out of memory.
    2. karma-phantomjs-launcher & karma-phantomjs2-launcher do not hook the stdout/stderr output for their started browser process and so I've seen some instances that the started browser just hangs and gets disconnected, most likely due to its stderr output getting filled up

    The first problem can be worked around by splitting your test suite into smaller ones. Or, you could research if there is perhaps a way to tell PhantomJS to run its JavaScript garbage collection, but I have not gone down that road so can't provide much more detail there.

    The second problem can be fixed by:

    1. using the latest karma-phantomjs-launcher version that hooks browser the stdout/stderr output (fixed in version 0.2.1)
    2. using a version of karma-phantomjs2-launcher from its pull request #5 which brings in upstream changes from the base karma-phantomJS-launcher project and thus resolves the problem here as well.

提交回复
热议问题