
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
grunt-jasmine-task
Advanced tools
Grunt task for running jasmine specs.
Status: stable
Any timeout troubles with tests finishing before the injection of the grunt task files should be solved, if not please reopen #4.
You can contact me on twitter: @camillereynders
Make sure you got PhantomJS installed, which is a headless browser. Unfortunately PhantomJS cannot be installed automatically through grunt. See the grunt faq for installation instructions.
Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-jasmine-task
(ie. the plugin is installed locally. If you want to install it globally - which is not recommended - check out the official grunt documentation)
You also need to install the temporary module
Although it is marked as a dependency in the grunt-jasmine-task module and automatically is installed together with the jasmine plugin, for some reason it cannot be found, therefore it needs to be installed separately, either as a global or local module.
To install it locally do:
npm install temporary
Then add this line to your project's grunt.js gruntfile at the bottom:
grunt.loadNpmTasks('grunt-jasmine-task');
Next you need to create (a) target(s) for the jasmine task.
If you want to run one file just add this to the grunt.initConfig object
jasmine: {
all: ['specs/specrunner.html']
},
Obviously you need to replace specs/specrunner.html with the location of your jasmine spec running html file.
Since v0.2.1: errorReporting config option. âš‘
When errorReporting is true the failing spec description will be outputted to the console, even when run in non-verbose mode.
jasmine: {
all: {
src:['specs/specrunner.html'],
errorReporting: true
}
},
Since v0.2.0: timeout config option.
By default the task will fail after 10 seconds of inactivity, however you can override this if you want:
jasmine: {
all: {
src:['specs/specrunner.html'],
timeout: 20000 //in milliseconds
}
},
This is useful for async assertions that may require more than 10 seconds to run.
Now you can run the jasmine task with:
grunt jasmine
By default the jasmine task outputs in non-verbose mode, meaning it will output dots for passed specs and F's for failed ones.
You can see which spec is failing by running the task in verbose mode:
grunt jasmine -v
or (since v0.2.1) you can turn on reporting for failing specs even in non-verbose mode, see errorReporting config option
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.
More info on creating grunt plugins
errorReporting configuration optiontimeout configuration optionCopyright (c) 2012 Camille Reynders
Licensed under the MIT license.
FAQs
Grunt task for running Jasmine specs
The npm package grunt-jasmine-task receives a total of 49 weekly downloads. As such, grunt-jasmine-task popularity was classified as not popular.
We found that grunt-jasmine-task demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.