Skip to content

Commit c8f6f5e

Browse files
committed
1 parent 1be1ae1 commit c8f6f5e

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

lib/reporters/Teamcity.js

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@ var escTCString = function (message) {
1919
};
2020

2121
var getTestName = function (result) {
22-
return result.slice(1).join(' ');
22+
return result.description;
2323
};
2424

25+
var getSuiteName = function(result) {
26+
return result.suite.join(' ');
27+
};
28+
29+
2530
var TeamcityReporter = function(formatError, reportSlow) {
2631
BaseReporter.call(this, formatError, reportSlow);
2732

@@ -37,7 +42,7 @@ var TeamcityReporter = function(formatError, reportSlow) {
3742

3843
this.specSuccess = function(browser, result) {
3944
var browseResult = this.checkNewSuit(browser, result);
40-
var testName = getTestName(result.suite);
45+
var testName = getTestName(result);
4146

4247
browseResult.log.push(util.format(this.TEST_START, escTCString(testName)));
4348
browseResult.log.push(util.format(this.TEST_END,
@@ -46,7 +51,7 @@ var TeamcityReporter = function(formatError, reportSlow) {
4651

4752
this.specFailure = function(browser, result) {
4853
var browseResult = this.checkNewSuit(browser, result);
49-
var testName = getTestName(result.suite);
54+
var testName = getTestName(result);
5055

5156
browseResult.log.push(util.format(this.TEST_START, escTCString(testName)));
5257
browseResult.log.push(util.format(this.TEST_FAILED, escTCString(testName),
@@ -57,29 +62,31 @@ var TeamcityReporter = function(formatError, reportSlow) {
5762

5863
this.specSkipped = function(browser, result) {
5964
var browseResult = this.checkNewSuit(browser, result);
60-
var testName = getTestName(result.suite);
65+
var testName = getTestName(result);
6166

6267
browseResult.log.push(util.format(this.TEST_IGNORED, escTCString(testName)));
6368
};
6469

6570
this.checkNewSuit = function(browser, result) {
6671
var browserResult = this.checkNewBrowser(browser);
67-
var suiteExists = browserResult.suits.indexOf(result.suite[0]) !== -1;
72+
var suiteName = getSuiteName(result);
73+
var suiteExists = browserResult.suits.indexOf(suiteName) !== -1;
6874

6975
if(!suiteExists) {
7076
if(browserResult.suits.length > 0) {
7177
browserResult.log.push(util.format(this.SUITE_END,
7278
escTCString(browserResult.suits[browserResult.suits.length - 1])));
7379
}
74-
browserResult.suits.push(result.suite[0]);
75-
browserResult.log.push(util.format(this.SUITE_START, escTCString(result.suite[0])));
80+
browserResult.suits.push(suiteName);
81+
browserResult.log.push(util.format(this.SUITE_START, escTCString(suiteName)));
7682
}
7783
return browserResult;
7884
};
7985

8086
this.checkNewBrowser = function(browser) {
8187
if(!this.browserResults[browser.id]) {
8288
this.browserResults[browser.id] = {
89+
name: browser.name,
8390
log : [],
8491
suits : []
8592
};
@@ -90,15 +97,15 @@ var TeamcityReporter = function(formatError, reportSlow) {
9097
this.onRunComplete = function(browsers, results) {
9198
var self = this;
9299

93-
Object.keys(this.browserResults).forEach(function(key) {
94-
var browserResult = self.browserResults[key];
100+
Object.keys(this.browserResults).forEach(function(browserId) {
101+
var browserResult = self.browserResults[browserId];
95102
if(browserResult.suits.length > 0) {
96103
browserResult.log.push(util.format(self.SUITE_END,
97104
escTCString(browserResult.suits[browserResult.suits.length - 1])));
98105
}
99-
self.write(self.BROWSER_START, key);
106+
self.write(self.BROWSER_START, browserResult.name);
100107
self.write(browserResult.log.join('\n'));
101-
self.write(self.BROWSER_END, key);
108+
self.write(self.BROWSER_END, browserResult.name);
102109
});
103110

104111
this.writeCommonMsg(browsers.map(this.renderBrowser).join('\n') + '\n');

0 commit comments

Comments
 (0)