☕️ Classic, reliable, trusted test framework for Node.js and the browser
escape the message so teamcity can handle them
Ben Lindseyf6a8ad4d508f
diff --git a/lib/reporters/teamcity.js b/lib/reporters/teamcity.jsindex 0db15e0c..c857c313 100644--- a/lib/reporters/teamcity.js+++ b/lib/reporters/teamcity.js@@ -5,6 +5,10 @@var Base = require('./base');+function tc_escape(text) {+ return (text || '').replace(/'/g, "|'");+}+/*** Expose `Teamcity`.*/@@ -20,19 +24,19 @@ function Teamcity(runner) {});runner.on('test', function(test) {- console.log("##teamcity[testStarted name='%s']", test.fullTitle());+ console.log("##teamcity[testStarted name='%s']", tc_escape(test.fullTitle()));});runner.on('fail', function(test, err) {- console.log("##teamcity[testFailed name='%s' message='%s']", test.fullTitle(), err.message);+ console.log("##teamcity[testFailed name='%s' message='%s']", tc_escape(test.fullTitle()), tc_escape(err.message));});runner.on('pending', function(test) {- console.log("##teamcity[testIgnored name='%s' message='pending']", test.fullTitle());+ console.log("##teamcity[testIgnored name='%s' message='pending']", tc_escape(test.fullTitle()));});runner.on('test end', function(test) {- console.log("##teamcity[testFinished name='%s' duration='%s']", test.fullTitle(), test.duration);+ console.log("##teamcity[testFinished name='%s' duration='%s']", tc_escape(test.fullTitle()), test.duration);});runner.on('end', function() {