jakejs / jake

JavaScript build tool, similar to Make or Rake. Built to work with Node.js.
http://jakejs.com
Apache License 2.0
1.97k stars 190 forks source link

testTask doesn't work under namespace #349

Closed akoltun closed 6 years ago

akoltun commented 6 years ago

If the test task is declared inside the namespace

namespace('test', function() {
  testTask('test inside namespace', function() {
    this.testName = 'task'
    this.testFiles.include(<test files>);
  });
});

the error arises:

TypeError: Cannot read property 'on' of undefined

because method task in the test_task.js module addresses the test task using self.testName.

  task(this.testName, prereqs, {async: true}, function () {
    var t = jake.Task[self.testName + ':run'];
    t.on('complete', function () {
      complete();
    });
    // Pass args to the namespaced test
    t.invoke.apply(t, arguments);
  });
akoltun commented 6 years ago

Pull request #350 solves this issue

mde commented 6 years ago

Published fix to NPM, v8.0.18.