-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathteamcity-reporter.js
37 lines (30 loc) · 1.03 KB
/
teamcity-reporter.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
'use strict';
var util = require('util');
/**
* @param {Errors[]} errorsCollection
*/
module.exports = function(errorsCollection) {
var errorCount = 0;
console.log('##teamcity[testSuiteStarted name=\'JSCS\']');
/**
* Formatting every error set.
*/
errorsCollection.forEach(function(errors) {
var file = errors.getFilename();
if (!errors.isEmpty()) {
console.log(util.format('##teamcity[testStarted name=\'%s\']', file));
errors.getErrorList().forEach(function(error) {
errorCount++;
console.log(util.format(
'##teamcity[testFailed name=\'%s\' message=\'line %d, col %d, %s\']',
file, error.line, error.column, error.message.replace('\'', '|\'')));
});
console.log(util.format('##teamcity[testFinished name=\'%s\']', file));
}
});
if (errorCount === 0) {
console.log('##teamcity[testStarted name=\'JSCS\']');
console.log('##teamcity[testFinished name=\'JSCS\']');
}
console.log(util.format('##teamcity[testSuiteFinished name=\'JSCS\']'));
};