Skip to content Skip to sidebar Skip to footer

How Can I Make A Grunt Task Fail If One Of Its Sub Tasks Fail?

I have a build task in grunt, which looks like this: grunt.registerTask('build', ['jshint', 'uglify']); The problem is that the uglify task runs even if the jshint task fails, how

Solution 1:

The default behavior in Grunt is to not run subsequent tasks if one fails. So you must be using the force option somewhere. You are either:

1 - passing --force on the command line

2 - calling grunt.option( 'force', true ); somewhere

3 - have the jshint force option set on your jshint task

Note that in the case of calling grunt.option( 'force', true );, it remains true for the remainder of the batch, not just inside the task where it was set. see this question and this question for details.


Post a Comment for "How Can I Make A Grunt Task Fail If One Of Its Sub Tasks Fail?"