I am trying to learn 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 upped the timeout for that test to 60000, and it works in Jasmine
But when I try to run the tests using Grunt, it does not allow the playing the game test to finish. How can I up the PhantomJS timeout to allow this test enough time to complete?
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.
Grunt 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"]);
};