Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions bin/nodeunit
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,42 @@ var args = (process.ARGV || process.argv).slice(2);

var files = [];

/**
* Method responsible for recursive search for test files passed
* in arguments
*/
var parsePath = function (dir, files) {

var stat = fs.statSync(dir);
if (!stat || !stat.isDirectory()) {
files.push(dir);
return files;
}

fs.readdirSync(dir).forEach(function (file) {

file = dir + '/' + file;

var stat = fs.statSync(file);

if (stat && stat.isDirectory()) {
parsePath(file, files);
} else {
files.push(file);
}

});

return files;
};

var testrunner,
config_file,
config_param_found = false,
output_param_found = false,
reporter_file = 'default',
reporter_param_found = false,
testspec_param_found = false;
testspec_param_found = false,
testFullSpec_param_found = false;

var usage = "Usage: nodeunit [options] testmodule1.js testfolder [...] \n" +
Expand Down Expand Up @@ -97,7 +126,7 @@ args.forEach(function (arg) {
console.log(usage);
process.exit(0);
} else {
files.push(arg);
files = parsePath(arg, files);
}
});

Expand Down