Alert: This page is under construction and may contain inaccurate information. Want to help fix it? Ping @samuelsidler (sam on Slack) in the #docs channel.

Testing patches is an important part of ensuring the quality of WordPress releases.

Using Grunt #

Grunt is a great way to test patches that have been uploaded to Trac. To use grunt, follow these steps:

Note: Using VVV? Steps 1 through 6 are not necessary to get setup. However, you should use the command: vagrant ssh and go to the checkout of WordPress develop to run your grunt tasks through there. Note, you may have to use sudo if a command doesn’t work.

  1. Install nodejs and npm to your development environment.
  2. Clone the develop WordPress repository located at https://develop.svn.wordpress.org/
  3. Run npm install to get all the dependencies.
  4. Install grunt cli globally using npm install -g grunt-cli.
  5. Run grunt build to get the fully-built version
  6. Setup your server to use /build as the root (varies depending on how your development environment is setup).
  7. In order for changes to /src to be reflected in /build, run grunt watch while you are working.

Now that grunt is setup, using it to test a patch is easy! Just type in grunt patch:####, replacing #### with either a ticket number from Trac or a patch URL.

Ready to test your environment? Use grunt test to automatically run automated tests. Note that this step requires phpunit to be installed.

If you’re a committer, be sure to run grunt precommit before committing code, especially code that touches anything on the front-end (CSS/JS).

Note: if you are getting errors on running test or precommit and using Vagrant, try removing npm_modules and then running npm install. If errors continue try checking your permissions.

This section needs information on: SCRIPT_DEBUG (must be set to true), browserify + media, color schemes, and RTL.

And: A lot of this information should move to a different page because it’s not just about testing a patch. Where would you put a page on everything grunt?

Top ↑

Testing without Grunt #

[This section needs to be renamed and filled with glorious content.]