Skip to content

grunt.task.requires fails if referring to a task that ran with a target #998

Description

@pgilad

When using grunt.task.requires('taskname') it will fail when the task actually ran with a target, i.e taskname:targetname.

This is contrary to what I feel is the expected behavior, if I just want to ensure a certain task ran, and don't care about which target of it was used, this will fail.

This is is found in the code in task.js:

// Test to see if all of the given tasks have succeeded.
  Task.prototype.requires = function() {
    this.parseArgs(arguments).forEach(function(name) {
        var success = this._success[name];
      if (!success) {
        throw new Error('Required task "' + name +
          '" ' + (success === false ? 'failed' : 'must be run first') + '.');
      }
    }.bind(this));
  };

Where this._success contains successful tasks but with target names.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions