Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Prevent infinite namespace nesting when recalling TestTask run

  • Loading branch information...
commit d8ab3da8eeed38723e2983191173a14ffe6d6ba9 1 parent 3190da6
mde authored
Showing with 17 additions and 7 deletions.
  1. +17 −7 lib/test_task.js
View
24 lib/test_task.js
@@ -88,10 +88,17 @@ var TestTask = function (name, definition) {
task('run', function (pat) {
var p = pat || '.*'
- , re = new RegExp(pat)
- , testFiles = self.testFiles.toArray().filter(function (f) {
- return (re).test(f);
- });
+ , re
+ , testFiles;
+
+ // Don't nest; make a top-level namespace. Don't want
+ // re-calling from inside to nest infinitely
+ jake.currentNamespace = jake.defaultNamespace;
+
+ re = new RegExp(pat)
+ testFiles = self.testFiles.toArray().filter(function (f) {
+ return (re).test(f);
+ });
// Create a namespace for all the testing tasks to live in
namespace(self.testName + 'Exec', function () {
@@ -145,7 +152,7 @@ var TestTask = function (name, definition) {
namespace(file, function () {
if (typeof exp.before == 'function') {
- prereqs.push(file + ':before');
+ prereqs.push(self.testName + 'Exec:' + file + ':before');
// Create the task
createTask('before', exp.before);
}
@@ -157,13 +164,13 @@ var TestTask = function (name, definition) {
}
// Add the namespace:name of this test to the list of prereqs
// for the dummy top-level task
- prereqs.push(file + ':' + p);
+ prereqs.push(self.testName + 'Exec:' + file + ':' + p);
// Create the task
createTask(p, exp[p]);
}
if (typeof exp.after == 'function') {
- prereqs.push(file + ':after');
+ prereqs.push(self.testName + 'Exec:' + file + ':after');
// Create the task
createTask('after', exp.after);
}
@@ -179,8 +186,11 @@ var TestTask = function (name, definition) {
jake.logger.log('All tests ran successfully');
complete();
});
+
topLevel.invoke(); // Do the thing!
});
+
+
}, {async: true});
});
Please sign in to comment.
Something went wrong with that request. Please try again.