Grunt task for running Buster.JS tests in Node.js or headless in PhantomJS
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-buster
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-buster');
Then, you must install Buster.JS:
npm install buster
If you want to run tests for the browser environment, you also need to install PhantomJS:
npm install phantomjs
In your project's Gruntfile, add a section named buster
to the data object
passed into grunt.initConfig()
. You then need to define at least one target
for grunt buster
to have any effect.
Example of a minimal working configuration:
buster: {
foo: {}
}
The buster
object can have an arbitrary number of targets, like foo
in the
above example. If you run grunt buster
, all targets are executed. If you run
grunt buster:foo
, only the foo
target is executed.
No options are needed to get started, as grunt-buster will use default values if none is specified.
An object with options passed as command line arguments to buster test
. For
available options for buster test
run:
buster test --help
An object with options passed as command line arguments to buster server
. For
available options for buster server
run:
buster server --help
Growl support is optional. If you would like to use it follow the instructions
on how to install node-growl, then
enable Growl notifications in the buster
task in your Gruntfile.
Example:
buster: {
options: {
growl: true
}
}
You should now get notifications whenever your test suite passes or fails.
buster: {
foo: {
test: {
config: 'path/to/my/buster.js'
},
server: {
port: 1111
}
},
bar: {
options: {
growl: false
}
},
options: {
growl: true
}
}
The above config will for the foo
target run buster test
with the
argument --config path/to/my/buster.js
, and run buster server
with the
argument --port 1111
, with Growl notifications when the tests complete.
For the bar
target, default configuration will be used, and Growl
notifications will be turned off.
If you wish to contribute, please ensure a green test suite.
Install development dependencies:
npm install
Running the test suite:
npm test
Starting a watch loop listening to file changes and running the test suite:
npm start
- Fix broken URLs in package description
- Updated project URLs after move to busterjs organization on GitHub
- Require Node.js >= 0.8.0
- Fix
path.existsSync
deprecation warning - Declare a peer dependency on Grunt ~0.4.0
- Made Growl notifications optional. You must now install the
growl
package from npm and setoptions.growl
totrue
to get notifications. - Added support for Grunt multi-tasks. You must now define at least one target
for the
buster
task to have any work to do. See the above docs for a minimal config example. (Thanks to Richard Nespithal) - Add
--server
option tobuster-test
(Thanks to Andreas Köberle) - Add support for locally installed versions of Buster.JS and PhantomJS (Thanks to Stein Martin Hustad)
- Looks for buster.js in test/ and spec/ in addition to the root folder
- Fixed corrupt error.png and ok.png (Thanks to Paweł Maciejewski)
- Removed console non-printable characters from growl text message (Thanks to Paweł Maciejewski)
- Ensure that tests is not run until PhantomJS finished starting (thanks to Harrison)
- Initial release