Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

QUnit integration with TeamCity (via service messages)Supports stacktraces, comparison failure diffs for large texts.

View qunit.teamcity.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
(function(QUnit) {
 
var tcEscape = function(str) {
str = str ? str.toString() : "";
str = str.replace(/\n/g, "|n");
str = str.replace(/\r/g, "|r");
str = str.replace(/(['\[\]])/g, "|$1");
return str;
};
 
//QUnit.moduleStart({ name })
QUnit.moduleStart(function(settings){
console.log("##teamcity[testSuiteStarted name='" + settings.name + "']");
});
 
//QUnit.moduleDone({ name, failed, passed, total })
QUnit.moduleDone(function(settings){
console.log("##teamcity[testSuiteFinished name='" + settings.name + "']");
});
 
//QUnit.testStart({ name })
QUnit.testStart(function (settings){
console.log("##teamcity[testStarted name='" + settings.name + "' captureStandardOutput='true']");
});
 
//QUnit.testDone({ name, failed, passed, total })
QUnit.testDone(function(settings){
if (settings.name) {
console.log("##teamcity[testFinished name='" + settings.name + "']");
}
});
 
QUnit.log(function( details ) {
if (!details.result) {
var isComparison = details.expected || details.actual;
 
if ( (isComparison && ("" + details.actual + details.expected).length > 10) ) {
console.log("##teamcity[testFailed type='comparisonFailure' name='" + details.name
+"' message='" + tcEscape(details.message)
+ "' details='" + tcEscape(details.source) +
"' expected='" + tcEscape(details.expected) +
"' actual='" + tcEscape(details.actual)+ "']");
}
 
var message = "";
if (isComparison) {
message = "Expected: " + details.expected + ", Actual: " + details.actual;
}
if (details.message) {
message = details.message + ": " + message;
}
 
console.log("Message: " + message);
console.log("##teamcity[testFailed name='" + details.name
+"' message='" + tcEscape(message) + "' details='" + tcEscape(details.source) + "']");
}
});
 
})(QUnit);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.