Ensure tasks are an array. Fixes GH-115.
This commit is contained in:
parent
d83c44eb93
commit
64902fe3d9
@ -25,6 +25,9 @@ module.exports = function(grunt) {
|
||||
this.startedAt = false;
|
||||
this.spawned = null;
|
||||
this.changedFiles = Object.create(null);
|
||||
if (typeof this.tasks === 'string') {
|
||||
this.tasks = [this.tasks];
|
||||
}
|
||||
}
|
||||
|
||||
// Run it
|
||||
|
14
test/fixtures/multiTargets/Gruntfile.js
vendored
14
test/fixtures/multiTargets/Gruntfile.js
vendored
@ -11,26 +11,26 @@ module.exports = function(grunt) {
|
||||
watch: {
|
||||
one: {
|
||||
files: ['lib/one.js', 'Gruntfile.js'],
|
||||
tasks: ['echo:one']
|
||||
tasks: 'echo:one',
|
||||
},
|
||||
two: {
|
||||
files: ['lib/two.js'],
|
||||
tasks: ['echo:two']
|
||||
tasks: ['echo:two'],
|
||||
},
|
||||
wait: {
|
||||
files: ['lib/wait.js'],
|
||||
tasks: ['echo:wait']
|
||||
tasks: ['echo:wait'],
|
||||
},
|
||||
interrupt: {
|
||||
files: ['lib/interrupt.js'],
|
||||
tasks: ['echo:interrupt'],
|
||||
options: { interrupt: true }
|
||||
options: { interrupt: true },
|
||||
},
|
||||
fail: {
|
||||
files: ['lib/fail.js'],
|
||||
tasks: ['echo:fail']
|
||||
}
|
||||
}
|
||||
tasks: ['echo:fail'],
|
||||
},
|
||||
},
|
||||
});
|
||||
// Load the echo task
|
||||
grunt.loadTasks('../tasks');
|
||||
|
8
test/fixtures/oneTarget/Gruntfile.js
vendored
8
test/fixtures/oneTarget/Gruntfile.js
vendored
@ -2,12 +2,14 @@ module.exports = function(grunt) {
|
||||
'use strict';
|
||||
grunt.initConfig({
|
||||
echo: {
|
||||
files: ['lib/*.js']
|
||||
files: ['lib/*.js'],
|
||||
},
|
||||
watch: {
|
||||
files: ['<%= echo.files %>'],
|
||||
tasks: ['echo']
|
||||
}
|
||||
// Dont make tasks an array
|
||||
// To ensure it works with cliArgs: See #115
|
||||
tasks: 'echo',
|
||||
},
|
||||
});
|
||||
// Load the echo task
|
||||
grunt.loadTasks('../tasks');
|
||||
|
@ -29,7 +29,7 @@ exports.watchConfig = {
|
||||
oneTarget: function(test) {
|
||||
test.expect(2);
|
||||
var cwd = path.resolve(fixtures, 'oneTarget');
|
||||
var assertWatch = helper.assertTask('watch', {cwd:cwd});
|
||||
var assertWatch = helper.assertTask(['watch', '--debug'], {cwd:cwd});
|
||||
assertWatch(function() {
|
||||
var write = 'var test = true;';
|
||||
grunt.file.write(path.join(cwd, 'lib', 'one.js'), write);
|
||||
|
Loading…
Reference in New Issue
Block a user