Grunt time while running jasmine test

I'm trying to learn how to use Grunt ...

When I run the following tests in the Jasmine spec runner:

http://memory-card-game.herokuapp.com/spec-runner.html

They work ... it takes time, because the last test plays the entire game. I increased the timeout for this test to 60,000 and it works in Jasmine

But when I try to run tests using Grunt, this does not allow the game to complete. How can I timeout PhantomJS to complete this test enough time?

Game Card
   βœ“ can be created with a value   
   βœ“ has a DOM element for the card   
   βœ“ can flip   
   βœ“ can be discarded   
 Game Deck
   βœ“ can be created   
   βœ“ can hold cards   
   βœ“ can shuffle   
 Event Caller
   βœ“ can be created   
   βœ“ can be inherited   
   βœ“ should add subscribers   
   βœ“ should remove subscribers   
   βœ“ should emit events   
   βœ“ should emit with arguments   
 Memory Game
   Starting the Game
     βœ“ should be able to create a new game   
     βœ“ should deal the game cards to a DOM Element   
     βœ“ should emit 'deal' event   
     βœ“ should deal shuffled cards   
     βœ“ should be able to create a game in debug mode   
   Playing the Game
     βœ“ should be able to flip over one card   
     flipping over two cards
       βœ“ should emit 'match' event   
       βœ“ should flip over mismatched cards   
       βœ“ should remove matched cards   
       βœ“ should not allow a third card flip   
   Ending the Game
     - should emit 'end' event...
Warning: PhantomJS timed out, possibly due to an unfinished async spec. Use --force to continue.

Grant File:

module.exports = function (grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON("package.json"),
        jasmine: {
            src: ["public/js/*.js", "!public/js/main.js"],
            timeout: 60000,
            options: {
                specs: "public/test/*-spec.js"
            },
            phantomjs : {
                resourceTimeout : 60000
            }
        }
    });
    grunt.loadNpmTasks("grunt-contrib-jasmine");
    grunt.registerTask("test", ["jasmine"]);
    grunt.registerTask("default", ["test"]);
};
+4
source share
2 answers

. HTML innerHTML. innerHTML .

0

, Warning: PhantomJS timed out, possibly due to an unfinished async spec. Use --force to continue.

, Jasmine, PhantomJS/Grunt/grunt-contrib-jasmine. , , :

afterEach(function () {
    $body.empty();
});

, DOM . JS-, PhantomJS . Grunt .

:

afterEach(function () {
    $element.remove();
    $nav.remove();
});

, DOM, , , JS , .

, 77 - PhantomJS.

0

Source: https://habr.com/ru/post/1548109/


All Articles