Check WordPress plugin ’tested up to’ headers and compare with versions from the wordpress.org API.
This Grunt plugin helps to check that your 'tested up to' and 'WC tested up to' headers have not fallen behind the latest versions of WordPress and WooCommerce. It's useful in automated checks prior to releasing a plugin.
This Grunt plugin is a wrapper for the wptools module. It will:
- Fetch the 'tested up to' header from the plugin readme.txt file (and optionally the 'WC tested up to' header from your plugin's main PHP file).
- Check the latest version of WordPress and WooCommerce via the wordpress.org API.
- Report a pass or fail depending on whether the 'tested up to' versions need to be bumped.
A pass result looks like this:
$ grunt wptools
Running "wptools:test_wordpress" (wptools) task
PASS: WordPress is at 4.9.8, plugin is tested to 4.9.
Running "wptools:test_woocommerce" (wptools) task
PASS: WooCommerce is at 3.4.4, plugin is tested to 3.4.
Here's a fail result:
$ grunt wptools
Running "wptools:test_wordpress" (wptools) task
>> FAIL: WordPress is at 4.9.8, plugin is tested to 3.9.
>> Update the 'Tested up to:' version in /path/to/plugin/readme.txt.
Warning: Task "wptools:test_wordpress" failed. Use --force to continue.
Aborted due to warnings.
The Grunt task will not auto-fix 'tested up to' version numbers. You should test your plugin with the latest WordPress or WooCommerce and update the tested up to headers manually if all is well.
This plugin requires Grunt ~0.4.5
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-wptools --save-dev
Once the plugin has been installed, it can be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-wptools');
In your project's Gruntfile, add a section named wptools
to the object passed into grunt.initConfig()
.
grunt.initConfig({
wptools: {
test_wordpress: {
options: {
test: 'wordpress',
readme: 'readme.txt',
},
},
test_woocommerce: {
options: {
test: 'woocommerce',
plugin: 'plugin.php',
},
}
},
});
test_wordpress
and test_woocommerce
can be named as you wish.
You can omit the test_woocommerce
section if this is not a WooCommerce plugin.
The 'readme' and 'plugin' options should be strings containing paths relative to your Gruntfile.
It's expected that your readme contains a 'Tested up to: x.x' header.
The plugin.php
should be the entry point to your WordPress plugin that contains your 'WC tested up to: x.x' header.
0.1.0 Initial release