Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Stop grunt execution with an error message and exit code of choice.
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
tasks
test add 'no-color' to inner calls to grunt
.gitignore first version
.hgignore first version
.jshintrc
.npmignore exclude .jshintrc from package
.travis.yml add node '0.10' to travis
Gruntfile.js change comments
LICENSE-MIT first version
README.md fix typo
package.json remove some dev dependencies that will be install anyway because of p…

README.md

grunt-fail

Build Status

Stop grunt execution with an error message and exit code of choice.

Installation

  1. Change directories to the root directory of your project
  2. npm install grunt-fail
  3. Add the following line to your Gruntfile.js
grunt.loadNpmTasks('grunt-fail');

Usage

The simplest usage is without any arguments, e.g.

from the command line

grunt fail

from within a Gruntfile

grunt.registerTask('default', ['fail']);

Arguments

grunt-fail takes an optional error message and an optional exit code as arguments.

For example

grunt "fail:Don't deploy:26"

If there is just one argument, it can be either a numerical exit code, or an error message.

The default message is "Failed on purpose."

The default exit code is 255.

More examples

command line

grunt "fail:no thanks"

Gruntfile

grunt.registerTask('test', ['vows', 'fail:99']);

Exit codes

Exit codes between 1 and 255 work well on all systems. Other codes may not work as expected.

Grunt doesn't consider an exit code of zero an error, so it won't fail. Don't use it!

Here are the exit codes used by grunt for reference.

Bugs, etc.

Please report any bugs, feature requests, etc. to grunt-fail's github issue tracker.

Something went wrong with that request. Please try again.