Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/mocha-3.1.2/lib/reporters/spec.js')
-rw-r--r--tests/lib/mocha-3.1.2/lib/reporters/spec.js81
1 files changed, 81 insertions, 0 deletions
diff --git a/tests/lib/mocha-3.1.2/lib/reporters/spec.js b/tests/lib/mocha-3.1.2/lib/reporters/spec.js
new file mode 100644
index 0000000000..993aff8dd3
--- /dev/null
+++ b/tests/lib/mocha-3.1.2/lib/reporters/spec.js
@@ -0,0 +1,81 @@
+'use strict';
+
+/**
+ * Module dependencies.
+ */
+
+var Base = require('./base');
+var inherits = require('../utils').inherits;
+var color = Base.color;
+
+/**
+ * Expose `Spec`.
+ */
+
+exports = module.exports = Spec;
+
+/**
+ * Initialize a new `Spec` test reporter.
+ *
+ * @api public
+ * @param {Runner} runner
+ */
+function Spec (runner) {
+ Base.call(this, runner);
+
+ var self = this;
+ var indents = 0;
+ var n = 0;
+
+ function indent () {
+ return Array(indents).join(' ');
+ }
+
+ runner.on('start', function () {
+ console.log();
+ });
+
+ runner.on('suite', function (suite) {
+ ++indents;
+ console.log(color('suite', '%s%s'), indent(), suite.title);
+ });
+
+ runner.on('suite end', function () {
+ --indents;
+ if (indents === 1) {
+ console.log();
+ }
+ });
+
+ runner.on('pending', function (test) {
+ var fmt = indent() + color('pending', ' - %s');
+ console.log(fmt, test.title);
+ });
+
+ runner.on('pass', function (test) {
+ var fmt;
+ if (test.speed === 'fast') {
+ fmt = indent() +
+ color('checkmark', ' ' + Base.symbols.ok) +
+ color('pass', ' %s');
+ console.log(fmt, test.title);
+ } else {
+ fmt = indent() +
+ color('checkmark', ' ' + Base.symbols.ok) +
+ color('pass', ' %s') +
+ color(test.speed, ' (%dms)');
+ console.log(fmt, test.title, test.duration);
+ }
+ });
+
+ runner.on('fail', function (test) {
+ console.log(indent() + color('fail', ' %d) %s'), ++n, test.title);
+ });
+
+ runner.on('end', self.epilogue.bind(self));
+}
+
+/**
+ * Inherit from `Base.prototype`.
+ */
+inherits(Spec, Base);