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
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"]);
};
source
share