-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
45 lines (36 loc) · 1.44 KB
/
index.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
'use strict';
const util = require('util');
module.exports = {
report: function report (results) {
let lastFile = '';
console.log('##teamcity[testSuiteStarted name=\'lesshint\']');
results.forEach((result) => {
const errFile = result.fullPath.replace(process.cwd() + '/', '');
if (lastFile !== errFile) {
if (lastFile) {
console.log(util.format('##teamcity[testFinished name=\'%s\']', lastFile));
}
lastFile = errFile;
console.log(util.format('##teamcity[testStarted name=\'%s\']', lastFile));
}
console.log(
util.format(
'##teamcity[testFailed name=\'%s\' message=\'line %d, col %d, %s (%s) %s\']',
lastFile,
result.line,
result.column,
result.severity === 'error' ? 'Error' : 'Warning',
result.linter,
result.message.replace('\'', '|\'')
)
);
});
if (results.length) {
console.log(util.format('##teamcity[testFinished name=\'%s\']', lastFile));
} else {
console.log('##teamcity[testStarted name=\'lesshint\']');
console.log('##teamcity[testFinished name=\'lesshint\']');
}
console.log('##teamcity[testSuiteFinished name=\'lesshint\']');
}
};