-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
If a multi-task is registered, and this multi-task is invoked with a section which is an array while grunt is run with the --verbose
option, the build will terminate with the error message:
Warning: pattern.indexOf is not a function Use --force to continue.
The exception itself is thrown at line 45 in file.js, but it comes from task.normalizeMultiTaskFiles at line 168 in task.js
where src is now [1, 2, 3] when it processes the foo section, because line 110 in task.js interprets the foo section as if it was a file specification in a non-multi-task, and creates an object with src=[1, 2, 3] and dest='foo'.
Consider the example from the documentation:
module.exports = grunt => {
grunt.initConfig({
log: {
foo: [1, 2, 3],
bar: 'hello world',
baz: false
}
});
grunt.task.registerMultiTask('log', 'Log stuff.', function() {
grunt.log.writeln(this.target + ': ' + this.data);
});
}
Given now also a package.json of:
{
"main": "index.js",
"scripts": {
"build": "grunt log",
"verbose": "grunt log --verbose"
},
"devDependencies": {
"grunt": "1.6.1"
}
}
one can reproduce the error with:
npm i
npm run build
npm run verbose
Metadata
Metadata
Assignees
Labels
No labels