Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
grunt-contrib-jasmine-phantom
Advanced tools
Run jasmine specs headlessly through PhantomJS with more memory optimization.
Run jasmine specs headlessly through PhantomJS.
This plugin is a fork of grunt-contrib-jasmine. This plugin works around solving memory issues caused by Phantom browser. But it works bit slow.
Todos : Rewrite tests for this plugin, check all the other functionalities.
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-phantom --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-phantom');
Run this task with the grunt jasmine
command.
If you want to run specific Suite or any spec. _Run this task with the grunt jasmine:unit:run="suite1|suite2|......etc"
unit
-> It contains options for jasmine task to run specs.
Automatically builds and maintains your spec runner and runs your tests headlessly through PhantomJS.
Run your tests on your local filesystem or via a server task like grunt-contrib-connect.
Specify coverage field in options passed as mentioned in options section and the run jasmine:unit --coverage
Use your own SpecRunner templates to customize how grunt-contrib-jasmine
builds the SpecRunner. See the
wiki for details and third party templates for examples.
Supports AMD tests via the grunt-template-jasmine-requirejs module
Type: Object
Configuration to run code coverage. By the default this plugin uses Blanket js.
Example:
coverage: {
yes: 'app/', // To be covered
no: "[spec, app/vendor]", // To be skipped
onCoverage: function(cb) { // Callback to run after all specs executed.
// Do your stuff with this.lcovPath, this.leastCovered and this.percentage
cb();
}
}
Type: String|Array
Your source files. These are the files that you are testing. If you are using RequireJS your source files will be loaded as dependencies into your spec modules and will not need to be placed here.
Type: String|Array
Your Jasmine specs.
Type: String|Array
Third party libraries like jQuery & generally anything loaded before source, specs, and helpers.
Type: String|Array
Non-source, non-spec helper files. In the default runner these are loaded after vendor
files
Type: String|Array
CSS files that get loaded after the jasmine.css
Type: String
Default: '2.0.1'
This is the jasmine-version which will be used. currently available versions are:
Due to changes in Jasmine, pre-2.0 versions have been dropped and tracking will resume at 2.0.0
Type: String
Default: _SpecRunner.html
The auto-generated specfile that phantomjs will use to run your tests.
Automatically deleted upon normal runs. Use the :build
flag to generate a SpecRunner manually e.g.
grunt jasmine:myTask:build
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: undefined
Specify a custom JUnit template instead of using the default junitTemplate
.
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/'
Without a host
, 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. Used to pass settings to the template.
Type: String|Array
Third party polyfill libraries like json2 that are loaded at the very top before anything else. es5-shim is loaded automatically with this library.
Type: String
Default: full
full
displays the full specs treeshort
only displays a success or failure character for each test (useful with large suites)none
displays nothingType: Boolean
Default: false
Display a list of all failed tests and their failure messages
Type: Object
,
Default : {}
If you want to attach any event on Phantom instance pass them through handlers object with event name as key and handler as value.
Name: build
Turn on this flag in order to build a SpecRunner html file. 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'
}
}
}
});
A complex version for the above example
// Example configuration
grunt.initConfig({
jasmine: {
customTemplate: {
src: 'src/**/*.js',
options: {
specs: 'spec/*Spec.js',
helpers: 'spec/*Helper.js',
template: require('exports-process.js')
vendor: [
"vendor/*.js",
"http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"
]
}
}
}
});
// 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 Jan 08 2015 16:18:55.
FAQs
Run jasmine specs headlessly through PhantomJS with more memory optimization.
The npm package grunt-contrib-jasmine-phantom receives a total of 1 weekly downloads. As such, grunt-contrib-jasmine-phantom popularity was classified as not popular.
We found that grunt-contrib-jasmine-phantom 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.