Stop grunt execution with an error message and exit code of choice.
- Change directories to the root directory of your project
npm install grunt-fail
- Add the following line to your
The simplest usage is without any arguments, e.g.
from the command line
from within a Gruntfile
grunt-fail takes an optional error message and an optional exit code as arguments.
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.
grunt "fail:no thanks"
grunt.registerTask('test', ['vows', 'fail:99']);
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!
Please report any bugs, feature requests, etc. to grunt-fail's github issue tracker.