Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
grunt-contrib-jasmine-phantom2
Advanced tools
Run jasmine specs headlessly through PhantomJS.
This plugin requires Grunt ~0.4.0
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-contrib-jasmine --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-contrib-jasmine');
Run this task with the grunt jasmine
command.
Automatically builds and maintains your spec runner and runs your tests headlessly through phantomjs.
Substantial credit goes to Camille Reynders (@creynders) for the first decent implementation of jasmine through grunt which served as motivation for all the future work.
Run your tests on your local filesystem or via a server task like grunt-contrib-connect.
Supply your templates that will be used to automatically build the SpecRunner.
Supports AMD tests via the grunt-template-jasmine-requirejs module
Type: String|Array
Minimatch - Your source files. These are the files that you are testing.
Type: String|Array
Minimatch - Your Jasmine specs.
Type: String|Array
Minimatch - Third party libraries, generally loaded before anything else happens in your tests. Libraries like jQuery and Backbone.
Type: String|Array
Minimatch - Non-source, non-spec helper files. In the default runner these are loaded after vendor
files
Type: String|Array
Minimatch - CSS files that get loaded after the jasmine.css
Type: String
Default: '1.3.1'
This is the jasmine-version which will be used. currently available versions are:
Type: String
Default: _SpecRunner.html
The auto-generated specfile that phantomjs will use to run your tests. Automatically deleted upon normal runs
Type: Boolean
Default: false
Prevents the auto-generated specfile used to run your tests from being automatically deleted.
Type: String
Default: undefined
Path to output JUnit xml
Type: Boolean
Default: false
Consolidate the JUnit XML so that there is one file per top level suite.
Type: String
Default: ''
The host you want phantomjs to connect against to run your tests.
e.g. if using an ad hoc server from within grunt
host : 'http://127.0.0.1:8000/'
Or, using templates
host : 'http://127.0.0.1:<%= connect.port %>/'
Not defining a host will mean your specs will be run from the local filesystem.
Type: String
Object
Default: undefined
Custom template used to generate your Spec Runner. Parsed as underscore templates and provided the expanded list of files needed to build a specrunner.
You can specify an object with a process
method that will be called as a template function.
See the Template API Documentation for more details.
Type: Object
Default: {}
Options that will be passed to your template via an 'options' hash. Used to pass settings to the template.
Name: build
Turn on this flag in order to rebuild the specrunner without deleting it. This is useful when troubleshooting templates, running in a browser, or as part of a watch chain e.g.
watch: {
pivotal : {
files: ['src/**/*.js', 'specs/**/*.js'],
tasks: 'jasmine:pivotal:build'
}
}
filename
grunt jasmine --filter=foo
will run spec files that have foo
in their file name.
folder
grunt jasmine --filter=/foo
will run spec files within folders that have foo*
in their name.
wildcard
grunt jasmine --filter=/*-bar
will run anything that is located in a folder *-bar
comma separated filters
grunt jasmine --filter=foo,bar
will run spec files that have foo
or bar
in their file name.
flags with space
grunt jasmine --filter="foo bar"
will run spec files that have foo bar
in their file name.
grunt jasmine --filter="/foo bar"
will run spec files within folders that have foo bar*
in their name.
Sample configuration to run Pivotal Labs' example Jasmine application.
// Example configuration
grunt.initConfig({
jasmine: {
pivotal: {
src: 'src/**/*.js',
options: {
specs: 'spec/*Spec.js',
helpers: 'spec/*Helper.js'
}
}
}
});
Supplying a custom template to the above example
// Example configuration
grunt.initConfig({
jasmine: {
customTemplate: {
src: 'src/**/*.js',
options: {
specs: 'spec/*Spec.js',
helpers: 'spec/*Helper.js',
template: 'custom.tmpl'
}
}
}
});
// Example configuration
grunt.initConfig({
jasmine: {
yourTask: {
src: 'src/**/*.js',
options: {
specs: 'spec/*Spec.js',
template: require('grunt-template-jasmine-requirejs')
}
}
}
});
NPM Templates are just node modules, so you can write and treat them as such.
Please see the grunt-template-jasmine-requirejs documentation for more information on the RequireJS template.
Task submitted by Jarrod Overson
This file was generated on Thu Feb 27 2014 09:24:51.
FAQs
Run jasmine specs headlessly through PhantomJS.
We found that grunt-contrib-jasmine-phantom2 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.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.