grunt-pagespeed-junit v0.3.1
grunt-pagespeed-junit
Pagespeed to junit task runner for grunt. Perfect for outputting results in Jenkins. See Google's doc for more details on the API.
Getting Started
This plugin requires Grunt ~0.4.4
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-pagespeed-junit --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-pagespeed-junit');
The "pagespeed_junit" task
Overview
In your project's Gruntfile, add a section named pagespeed_junit
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
pagespeed_junit: {
options: {
// Task-specific options go here.
}
}
});
Options
urls
Type: Array
A list of URL's for which the PageSpeed Insights API should generate results.
reports
Type: Array
The output destination for each URL.
key
Type: String
Your API key identifies your project and provides you with API access, quota, and reports.
threshold
Type: int
Default value: 60
The score threshold in which to fail the task.
ruleThreshold
Type: Number
The rule threshold in which to fail the individual rules.
locale
Type: String
The locale that results should be generated in.
rule
Type: Array
The PageSpeed rules to run.
strategy
Type: String
The strategy to use when analyzing the page.
Usage Examples
grunt.initConfig({
pagespeed_junit: {
options: {
urls: ['http://www.example.com'],
key: '<API_KEY>',
reports: ['results.xml'],
threshold: 10,
ruleThreshold: 2
}
}
});
###TODO
- move to gpagespeed
- ruleThreshold per rule
Contributing
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.
Release History
(Nothing yet)