Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multitask marked as success when forced #1530

Open
deckar01 opened this issue Jun 30, 2016 · 0 comments
Open

Multitask marked as success when forced #1530

deckar01 opened this issue Jun 30, 2016 · 0 comments

Comments

@deckar01
Copy link

Issue: When force is enabled, multitasks are unconditionally marked as success, even if a child task fails with a warning.

Expected behavior: A multitask is only marked as success if all the child tasks were marked as success.

Use case: Forcing a task to be performed unconditionally after a multitask, then making it required without force enabled to defer failure. See floriangosse/grunt-force-task#2 (comment). Related to #810.

Example:

module.exports = function (grunt) {
  'use strict';

  grunt.loadNpmTasks('grunt-force-task');

  grunt.registerTask('can-fail', function() {
    grunt.task.run('force:jasmine');
    grunt.task.run('istanbul_combine');
    grunt.task.run('jasmine-passed');
  });

  grunt.registerTask('test', function() {
    grunt.task.run('force:jasmine');
    grunt.task.run('istanbul_combine');
    grunt.task.run('jasmine-passed');
  });

  grunt.registerTask('jasmine-passed', function() {
    this.requires('jasmine');
  });
});

Since the jasmine task is a multitask, this.requires('jasmine') will never throw an error, because the jasmine task is being marked as a success. This is counter intuitive, because a child task like jasmine:cars can fail, generate a warning, but will be not marked as success.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant