Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow filtering of test files

  • Loading branch information...
commit a96c68d6924af21c0895b306347b5d5ed526e886 1 parent ab5da01
mde authored
Showing with 13 additions and 4 deletions.
  1. +13 −4 lib/test_task.js
View
17 lib/test_task.js
@@ -25,16 +25,25 @@ var TestTask = function (projectName, directory, namespaceName) {
var ns = namespaceName || 'test';
desc('Run the tests for ' + projectName);
- task(ns, [ns + ':run']);
+ task(ns, function () {
+ var t = jake.Task[ns + ':run'];
+ t.invoke.apply(t, arguments);
+ }, {async: true});
namespace(ns, function () {
- task('run', function () {
+ task('run', function (pat) {
+ var p = pat || '.*'
+ , re = new RegExp(pat);
// Grab all the JS files in the specified directory
- var jsFiles = jake.readdirR(directory).filter(function (f) {
+ // that match any regex passed in
+ var jsFiles = jake.readdirR(directory)
+ .filter(function (f) {
return (/\.js$/).test(f);
+ })
+ .filter(function (f) {
+ return (re).test(f);
});
-
// Create a namespace for all the testing tasks to live in
namespace(ns + 'Exec', function () {
// Each test will be a prereq for the dummy top-level task

0 comments on commit a96c68d

Please sign in to comment.
Something went wrong with that request. Please try again.