-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
2,106 additions
and
1,416 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
anti:gagarin@0.4.3 | ||
anti:gagarin@0.4.4 | ||
base64@1.0.2 | ||
callback-hook@1.0.2 | ||
check@1.0.4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
module.exports.table = require('./table'); | ||
|
||
var isBlocked = false; | ||
var secret = 0; | ||
|
||
var stdout_write = process.stdout._write.bind(process.stdout); | ||
var stderr_write = process.stderr._write.bind(process.stderr); | ||
|
||
process.stdout._write = function () { | ||
"use strict"; | ||
|
||
var args = Array.prototype.slice.call(arguments, 0); | ||
|
||
if (isBlocked) { | ||
args[0] = ''; | ||
args[1] = null; | ||
} | ||
return stdout_write.apply(null, args); | ||
} | ||
|
||
process.stderr._write = function () { | ||
"use strict"; | ||
var args = Array.prototype.slice.call(arguments, 0); | ||
if (isBlocked) { | ||
args[0] = ''; | ||
args[1] = null; | ||
} | ||
return stderr_write.apply(null, args); | ||
} | ||
|
||
module.exports.block = function block () { | ||
"use strict"; | ||
|
||
var mySecret = secret = Math.random(); | ||
|
||
isBlocked = true; | ||
|
||
return function write (data) { | ||
if (mySecret !== secret) { | ||
// someone has blocked after we did it | ||
return; | ||
} | ||
return stdout_write.call(null, data, null, function () {}); | ||
} | ||
} | ||
|
||
module.exports.unblock = function unblock () { | ||
"use strict"; | ||
isBlocked = false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
|
||
var Base = require('mocha').reporters.Base; | ||
var chalk = require('chalk'); | ||
|
||
module.exports = function table (listOfStats, write) { | ||
|
||
var labels = []; | ||
var titles = []; | ||
var symbol = '\u25A0'; | ||
|
||
write = write || process.stdout.write.bind(process.stdout); | ||
|
||
listOfStats.forEach(function (stats, index) { | ||
titles[index] = stats.title || ''; | ||
labels[index] = (index + 1) + ""; | ||
}); | ||
|
||
// trim titles to be at most 20 characters | ||
titles = titles.map(function (title) { | ||
if (title.length > 20) { | ||
return title.substr(0, 17) + '...'; | ||
} | ||
return title; | ||
}); | ||
|
||
var maxLabel = labels.reduce(function (memo, value) { return Math.max(memo, value.length); }, 0); | ||
var maxTitle = titles.reduce(function (memo, value) { return Math.max(memo, value.length); }, 0); | ||
|
||
// align right | ||
labels = labels.map(function (value) { | ||
while (value.length < maxLabel) { | ||
value = ' ' + value; | ||
} | ||
return value; | ||
}); | ||
|
||
// align left | ||
titles = titles.map(function (value) { | ||
while (value.length < maxTitle) { | ||
value = value + ' '; | ||
} | ||
return value; | ||
}); | ||
|
||
listOfStats.forEach(function (stats, index) { | ||
if (!!stats.end && stats.passes > 0) { | ||
write(stats.failures > 0 ? chalk.red('[' + Base.symbols.err + ']') : chalk.green('[' + Base.symbols.ok + ']')); | ||
} else { | ||
write(chalk.grey('[ ]')); | ||
} | ||
write(' ' + labels[index] + '. '); | ||
if (titles[index]) { | ||
write(titles[index] + ' ' + (stats.end ? '|' : '*')); | ||
} | ||
|
||
// draw "progress bar" | ||
write(' ' + stats.progress.map(function (data) { | ||
if (data.what === 'passed') { | ||
return chalk.green(symbol); | ||
} else if (data.what === 'skipped') { | ||
return chalk.cyan(symbol); | ||
} else if (data.what === 'failed') { | ||
return chalk.red('(') + chalk.grey(data.index) + chalk.red(')'); | ||
} | ||
}).join('')); | ||
|
||
write('\n'); | ||
}); | ||
|
||
// number of lines added | ||
return listOfStats.length; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.