summaryrefslogtreecommitdiff
path: root/node_modules/mocha/lib/reporters/dot.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/mocha/lib/reporters/dot.js')
-rw-r--r--node_modules/mocha/lib/reporters/dot.js62
1 files changed, 62 insertions, 0 deletions
diff --git a/node_modules/mocha/lib/reporters/dot.js b/node_modules/mocha/lib/reporters/dot.js
new file mode 100644
index 0000000..20158db
--- /dev/null
+++ b/node_modules/mocha/lib/reporters/dot.js
@@ -0,0 +1,62 @@
+
+/**
+ * Module dependencies.
+ */
+
+var Base = require('./base')
+ , color = Base.color;
+
+/**
+ * Expose `Dot`.
+ */
+
+exports = module.exports = Dot;
+
+/**
+ * Initialize a new `Dot` matrix test reporter.
+ *
+ * @param {Runner} runner
+ * @api public
+ */
+
+function Dot(runner) {
+ Base.call(this, runner);
+
+ var self = this
+ , stats = this.stats
+ , width = Base.window.width * .75 | 0
+ , n = 0;
+
+ runner.on('start', function(){
+ process.stdout.write('\n ');
+ });
+
+ runner.on('pending', function(test){
+ process.stdout.write(color('pending', '.'));
+ });
+
+ runner.on('pass', function(test){
+ if (++n % width == 0) process.stdout.write('\n ');
+ if ('slow' == test.speed) {
+ process.stdout.write(color('bright yellow', '.'));
+ } else {
+ process.stdout.write(color(test.speed, '.'));
+ }
+ });
+
+ runner.on('fail', function(test, err){
+ if (++n % width == 0) process.stdout.write('\n ');
+ process.stdout.write(color('fail', '.'));
+ });
+
+ runner.on('end', function(){
+ console.log();
+ self.epilogue();
+ });
+}
+
+/**
+ * Inherit from `Base.prototype`.
+ */
+
+Dot.prototype.__proto__ = Base.prototype; \ No newline at end of file