gruntjs / gruntjs/grunt

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

Open
#998 2 comments 0 reactions 0 assignees View on GitHub
Component: tasks
Dominant language
JavaScript
Stars
12.2k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.