Skip to content

Commit

Permalink
added spinning wheel
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhead committed May 7, 2010
1 parent 8260e38 commit 06485b8
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions bin/vows
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,17 @@ if (argv.length > 0) {
'. ', '.. ', '... ', ' ...',
' ..', ' .', ' .', ' ..',
'... ', '.. ', '. '
], wheel = [
'-', '\\', '|', '/'
];
var current = 0,
status = 0,
runningTests = false,
gracePeriod = 0,
statusText = '',
lastRun,
testFolder,
colors = ['32m', '33m', '91m'],
colors = ['32m', '33m', '31m'],
timer = setInterval(tick, 100),
root = fs.readdirSync('.');

Expand All @@ -80,17 +84,26 @@ if (argv.length > 0) {
cursorSave();
eraseLine();
esc(colors[status]);
print(clock[current]);

if (runningTests) {
print(' ' + esc('39m') + 'running tests...');
if (runningTests || gracePeriod) {
gracePeriod--;
print(wheel[current]);
esc('39m');
print(' working...');
if (current == wheel.length - 1) { current = -1 }
} else {
print(clock[current]);
print(' ' + statusText);
if (lastRun) {
esc('90m');
print( ' (' + lastRun.valueOf() + ')');
}
if (current == clock.length - 1) { current = -1 }
}

current++;
esc('39m');
cursorRestore();
current = (current == clock.length - 1) ? 0 : current + 1;
}

//
Expand All @@ -111,6 +124,9 @@ if (argv.length > 0) {
//
function changed(file) {
runningTests = true;
gracePeriod = 5;
current = 0;

file = /-(test|spec)$/.test(file) ? path.join(testFolder, file + '.js')
: path.join(testFolder, file + '-' + testFolder + '.js');

Expand All @@ -119,6 +135,7 @@ if (argv.length > 0) {
statusText = h + " honored, " +
b + " broken, " +
e + " errored";
lastRun = new(Date);

if (b || e) {
eraseLine();
Expand Down

0 comments on commit 06485b8

Please sign in to comment.