Skip to content

Commit

Permalink
Allow nodeunit:just:[array,of,test,files]
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron committed Oct 21, 2015
1 parent 3a7baca commit 04a9093
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,29 @@ module.exports = function(grunt) {

// Support running a single test suite:
// grunt nodeunit:just:motor for example
grunt.registerTask("nodeunit:just", "Run a single test specified by a target; usage: \"grunt nodeunit:just:<module-name>[.js]\"", function(file) {
grunt.registerTask("nodeunit:just", "Run a single or limited set of tests specified by a target; usage: 'grunt nodeunit:just:test-file' or 'grunt nodeunit:just:[test-file-a,test-file-b]'", function(file) {

var config = [
"test/bootstrap/*.js",
];

if (file) {
grunt.config("nodeunit.tests", [
"test/bootstrap/*.js",
"test/" + file + ".js",
]);
var files = [file];

//
// grunt nodeunit:just:[test-file-a,test-file-b]
//
if (file[0] === "[" && file[file.length - 1] === "]") {
files = file.match(/(\w+)/g);
}

if (files) {
files.forEach(function(file) {
config.push("test/" + file + ".js");
});

grunt.config("nodeunit.tests", config);
}
}

grunt.task.run("nodeunit");
Expand Down

0 comments on commit 04a9093

Please sign in to comment.