![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
grunt-buster
Advanced tools
Grunt task for running Buster.JS tests in Node.js or headless in PhantomJS
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.
It is possible to start one or more Buster.JS servers, PhantomJS instances or individual Buster.JS test runs by passing Grunt arguments when invoking tasks.
Grunt allows for command line arguments to be passed to multitasks, like so:
grunt task:subtask:argument1:argument2
. To pass arguments to, and execute all
subtasks of a multitask, skip the subtask name: grunt task::argument
. In
grunt-buster
, we use that to gain more granular control over which Buster.JS
components are executed, as described below in this section.
grunt buster::server
This starts all configured Buster.JS servers, without starting a Phantom.JS instance nor running any tests.
Note: Grunt will not block the server
and phantomjs
tasks by default. They
are intended to be used in combination with blocking tasks like
grunt-contrib-watch
. If you do not want to run either of the two in
combination with a watch command, you can supply the block
argument:
grunt buster::server:block
grunt buster::phantomjs
This allows you to capture browsers manually before executing the tests separately (see below).
Execute the tests only and not spawn neither a Buster.JS server nor PhantomJS, as they are assumed to be started manually in some other way.
grunt buster::test
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
Release history
package.json
version numbernpm
: npm publish
cross-spawn-async
so that a correct executable is resolved on Windowspackage.json
resolve-bin
to find buster
and phantomjs
executablesbuster
as a peer dependencybuster-server
, PhantomJS
and buster-test
executionverbose
path.existsSync
deprecation warninggrowl
package
from npm and set options.growl
to true
to get notifications.buster
task to have any work to do. See the above docs for a
minimal config example. (Thanks to Richard Nespithal)--server
option to buster-test
(Thanks to Andreas Köberle)FAQs
Grunt task for running Buster.JS tests in Node.js or headless in PhantomJS
The npm package grunt-buster receives a total of 42 weekly downloads. As such, grunt-buster popularity was classified as not popular.
We found that grunt-buster demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.