Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Remove teamcity reporter (fix #954)

Travis Jeffery16a55b28ebe6
diff --git a/History.md b/History.md
index 87504964..b7d4be08 100644
--- a/History.md
+++ b/History.md
@@ -3,6 +3,7 @@
* add: unified diff (#862)
* add: set MOCHA_COLORS env var to use colors (#965)
+ * remove: teamcity reporter (#954)
* fix: consistent return of it, it.only, and describe, describe.only (#840)
1.13.0 / 2013-09-15
diff --git a/bin/_mocha b/bin/_mocha
index b26d6729..90709373 100644
--- a/bin/_mocha
+++ b/bin/_mocha
@@ -126,7 +126,6 @@ program.on('reporters', function(){
console.log(' tap - test-anything-protocol');
console.log(' landing - unicode landing strip');
console.log(' xunit - xunit reporter');
- console.log(' teamcity - teamcity ci support');
console.log(' html-cov - HTML test coverage');
console.log(' json-cov - JSON test coverage');
console.log(' min - minimal reporter (great with --watch)');
diff --git a/lib/reporters/index.js b/lib/reporters/index.js
index 4750f26d..1c4fccf0 100644
--- a/lib/reporters/index.js
+++ b/lib/reporters/index.js
@@ -16,4 +16,3 @@ exports.Landing = require('./landing');
exports.JSONCov = require('./json-cov');
exports.HTMLCov = require('./html-cov');
exports.JSONStream = require('./json-stream');
-exports.Teamcity = require('./teamcity');
diff --git a/lib/reporters/teamcity.js b/lib/reporters/teamcity.js
deleted file mode 100644
index 032eea7d..00000000
--- a/lib/reporters/teamcity.js
+++ /dev/null
@@ -1,65 +0,0 @@
-
-/**
- * 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, "|'");
-}
diff --git a/mocha.js b/mocha.js
index d11f3419..9c34f90d 100644
--- a/mocha.js
+++ b/mocha.js
@@ -978,6 +978,7 @@ module.exports = function(suite){
context.describe.only = function(title, fn){
var suite = context.describe(title, fn);
mocha.grep(suite.fullTitle());
+ return suite;
};
/**
@@ -1002,6 +1003,7 @@ module.exports = function(suite){
var test = context.it(title, fn);
var reString = '^' + utils.escapeRegexp(test.fullTitle()) + '$';
mocha.grep(new RegExp(reString));
+ return test;
};
/**
@@ -1831,7 +1833,7 @@ exports = module.exports = Base;
* Enable coloring by default.
*/
-exports.useColors = isatty;
+exports.useColors = isatty || (process.env.MOCHA_COLORS !== undefined);
/**
* Inline diffs instead of +/-
@@ -2129,7 +2131,7 @@ function pad(str, len) {
* @api private
*/
-function inlineDiff(err) {
+function inlineDiff(err, escape) {
var msg = errorDiff(err, 'WordsWithSpace', escape);
// linenos
@@ -2722,7 +2724,6 @@ exports.Landing = require('./landing');
exports.JSONCov = require('./json-cov');
exports.HTMLCov = require('./html-cov');
exports.JSONStream = require('./json-stream');
-exports.Teamcity = require('./teamcity');
}); // module: reporters/index.js
@@ -3870,75 +3871,6 @@ function title(test) {
}); // module: reporters/tap.js
-require.register("reporters/teamcity.js", function(module, exports, require){
-
-/**
- * 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, "|'");
-}
-
-}); // module: reporters/teamcity.js
-
require.register("reporters/xunit.js", function(module, exports, require){
/**