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

前端 未结 3 547
盖世英雄少女心
盖世英雄少女心 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:10

    I had the same kind of issue with handling random crashes. Though i did not find a way to avoid them, there is the possibility to restart the grunt-task upon a crash.

    grunt.registerTask('karma-with-retry', function (opt) {
    var done = this.async();
    var count = 0;
    var retry = function () {
        grunt.util.spawn({
            cmd : "grunt",
            args : ["connect", "karma"], // your tasks
            opts: {
                stdio: 'inherit'
            }
        }, function (error, result, code) {
            count++;
            if (error && code === 90 /* Replace with code thrown by karma */) {
                if(count < 5) {
                    grunt.log.writeln("Retrying karma tests upon error: " + code );
                    retry();
                } else {
                    done(false);
                }
            } else {
                done(result);
            }
       });
    }
    retry();
    });
    

    Source https://github.com/ariya/phantomjs/issues/12325#issuecomment-56246505

提交回复
热议问题