Sha256: 95d446be15a3503f85b96439178be7630912b8337b136b1d77166640794affa6

Contents?: true

Size: 1.46 KB

Versions: 21

Compression:

Stored size: 1.46 KB

Contents

/**
 * Module dependencies.
 */

var Base = require('./base');

/**
 * Expose `Teamcity`.
 */

exports = module.exports = Teamcity;

/**
 * Initialize a new `Teamcity` reporter.
 *
 * @param {Runner} runner
 * @api public
 */

function Teamcity(runner) {
  Base.call(this, runner);
  var stats = this.stats;

  runner.on('start', function() {
    console.log("##teamcity[testSuiteStarted name='mocha.suite']");
  });

  runner.on('test', function(test) {
    console.log("##teamcity[testStarted name='" + escape(test.fullTitle()) + "']");
  });

  runner.on('fail', function(test, err) {
    console.log("##teamcity[testFailed name='" + escape(test.fullTitle()) + "' message='" + escape(err.message) + "']");
  });

  runner.on('pending', function(test) {
    console.log("##teamcity[testIgnored name='" + escape(test.fullTitle()) + "' message='pending']");
  });

  runner.on('test end', function(test) {
    console.log("##teamcity[testFinished name='" + escape(test.fullTitle()) + "' duration='" + test.duration + "']");
  });

  runner.on('end', function() {
    console.log("##teamcity[testSuiteFinished name='mocha.suite' duration='" + stats.duration + "']");
  });
}

/**
 * Escape the given `str`.
 */

function escape(str) {
  return str
    .replace(/\|/g, "||")
    .replace(/\n/g, "|n")
    .replace(/\r/g, "|r")
    .replace(/\[/g, "|[")
    .replace(/\]/g, "|]")
    .replace(/\u0085/g, "|x")
    .replace(/\u2028/g, "|l")
    .replace(/\u2029/g, "|p")
    .replace(/'/g, "|'");
}

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
stylus-source-0.38.0 vendor/node_modules/mocha/lib/reporters/teamcity.js
stylus-source-0.37.0 vendor/node_modules/mocha/lib/reporters/teamcity.js
stylus-source-0.36.1 vendor/node_modules/mocha/lib/reporters/teamcity.js
stylus-source-0.36.0 vendor/node_modules/mocha/lib/reporters/teamcity.js
stylus-source-0.35.1 vendor/node_modules/mocha/lib/reporters/teamcity.js
stylus-source-0.35.0 vendor/node_modules/mocha/lib/reporters/teamcity.js
stylus-source-0.34.1 vendor/node_modules/mocha/lib/reporters/teamcity.js
stylus-source-0.34.0 vendor/node_modules/mocha/lib/reporters/teamcity.js
stylus-source-0.33.1 vendor/node_modules/mocha/lib/reporters/teamcity.js
stylus-source-0.33.0 vendor/node_modules/mocha/lib/reporters/teamcity.js
stylus-source-0.32.1 vendor/node_modules/mocha/lib/reporters/teamcity.js
stylus-source-0.32.0 vendor/node_modules/mocha/lib/reporters/teamcity.js
stylus-source-0.31.0 vendor/node_modules/mocha/lib/reporters/teamcity.js
stylus-source-0.30.1 vendor/node_modules/mocha/lib/reporters/teamcity.js
stylus-source-0.30.0 vendor/node_modules/mocha/lib/reporters/teamcity.js
stylus-source-0.29.0 vendor/node_modules/mocha/lib/reporters/teamcity.js
stylus-source-0.28.2 vendor/node_modules/mocha/lib/reporters/teamcity.js
stylus-source-0.28.1 vendor/node_modules/mocha/lib/reporters/teamcity.js
stylus-source-0.28.0 vendor/node_modules/mocha/lib/reporters/teamcity.js
stylus-source-0.27.2 vendor/node_modules/mocha/lib/reporters/teamcity.js