grunt.registerTask with same name as task definition causes call stack overflow
- Dominant language
- JavaScript
- Stars
- 12.2k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
Problem occurs when grunt.registerTask('clean', ['clean']); is used alongside the grunt.initConfig({ clean: { ... } }); definition.
Simple example gruntfile.js
``` javascript
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: {
options: {
'no-write': true
},
build: ["something.js", "something.min.js"]
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.registerTask('clean', ['clean']);
};
```
Results in the following output:
...
> (node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.
> ...
> util.js:35
> var str = String(f).replace(formatRegExp, function(x) {
> RangeError: Maximum call stack size exceeded
Contributor guide
Research direction
Reproduce the failure using the gruntfile.js example, focusing on the interaction between grunt.initConfig, grunt.loadNpmTasks, and grunt.registerTask. Trace how the task named clean is resolved and run the same command to confirm the recursive call stack overflow is gone.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100