Pagespeed to junit task runner for grunt. Perfect for outputting results in Jenkins. See Google's doc for more details on the API.
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');
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.
}
}
});
Type: Array
A list of URL's for which the PageSpeed Insights API should generate results.
Type: Array
The output destination for each URL.
Type: String
Your API key identifies your project and provides you with API access, quota, and reports.
Type: int
Default value: 60
The score threshold in which to fail the task.
Type: Number
The rule threshold in which to fail the individual rules.
Type: String
The locale that results should be generated in.
Type: Array
The PageSpeed rules to run.
Type: String
The strategy to use when analyzing the page.
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
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.
(Nothing yet)