I have a test.js file with the following code:
jake = require('jake');
var t = new jake.Task("testtask", function(params) {
console.log(' *** params: ', params);
});
console.log(' *** about to invoke:');
t.invoke(['1', '2', 3]);
console.log(' *** done.');
When I run node test.js I get the following output:
*** about to invoke:
*** done.
I can console.log(t.invoke) and I get what appears to be a valid jake task.
So why is it not actually running the jake task?
Turns out, even though the documentation claims that the prerequisites are optional, you must still pass something, or it treats the function as the prerequisites.
The working code is below, notice the addition of the [] right after "testtask":
jake = require('jake');
var t = new jake.Task("testtask", [], function(params) {
console.log(' *** params: ', params);
});
console.log(' *** about to invoke:');
t.invoke(['1', '2', 3]);
console.log(' *** done.');