Permalink
Browse files

[bin] Add `--shuffle` option

`--shuffle` shuffles test files, making order completely random.
  • Loading branch information...
1 parent 4347cdd commit 796ac5dae3da557cec343c7d73f6f93c77767930 @mmalecki mmalecki committed Jun 18, 2012
Showing with 12 additions and 0 deletions.
  1. +12 −0 bin/vows
View
@@ -62,6 +62,7 @@ var options = {
watch: false,
coverage: false,
isolate: false,
+ shuffle: false,
nocolor: !process.stdout.isTTY
};
@@ -141,6 +142,9 @@ while (arg = argv.shift()) {
case 'supress-stdout':
options.supressStdout = true;
break;
+ case 'shuffle':
+ options.shuffle = true;
+ break;
case 'isolate':
case 'i':
options.isolate = true;
@@ -240,6 +244,14 @@ if (! options.watch) {
: a.replace(fileExt, '');
});
+ if (options.shuffle) {
+ var source = files.slice(0);
+ files.length = 0;
+ while (source.length) {
+ files.push(source.splice(Math.ceil(Math.random() * source.length) - 1, 1)[0]);
+ }
+ }
+
runSuites(importSuites(files), function (results) {
var status = results.errored ? 2 : (results.broken ? 1 : 0);

0 comments on commit 796ac5d

Please sign in to comment.