-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change-Id: I5facc788a1e9b84f2044a0ba40eaaa5aa90bb3b2
- Loading branch information
Colin McLeod
committed
Nov 27, 2013
1 parent
1bcb9a1
commit cc4b9d6
Showing
5 changed files
with
80 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = require('./lib/teamcity') | ||
module.exports = require('./lib/teamcity-cov'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
var JSONCov = require('mocha/lib/reporters/json-cov'); | ||
|
||
/** | ||
* Expose `Teamcity`. | ||
*/ | ||
|
||
exports = module.exports = TeamcityCov; | ||
|
||
/** | ||
* Initialize a new `Teamcity` reporter. | ||
* | ||
* @param {Runner} runner | ||
* @api public | ||
*/ | ||
|
||
function TeamcityCov(runner) { | ||
JSONCov.call(this, runner, false); | ||
|
||
runner.on('end', function(){ | ||
var data = this.cov; | ||
var threshold = this.threshold || 0; | ||
if (!data) { | ||
console.log("##teamcity[message text='CODE-COVERAGE CHECK FAILED' errorDetails='Error reading report file.' status='ERROR']"); | ||
return; | ||
} | ||
|
||
var cov = Math.ceil(data.coverage); | ||
|
||
console.log("##teamcity[message text='Code Coverage is " + cov + "%']"); | ||
console.log("##teamcity[blockOpened name='Code Coverage Summary']"); | ||
console.log("##teamcity[buildStatisticValue key='CodeCoverageB' value='" + cov + "']"); | ||
console.log("##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='" + data.hits + "']"); | ||
console.log("##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='" + data.sloc + "']"); | ||
console.log("##teamcity[buildStatisticValue key='CodeCoverageL' value='" + cov + "']"); | ||
console.log("##teamcity[buildStatisticValue key='PassedTestCount' value='" + data.passes.length + "']"); | ||
console.log("##teamcity[buildStatisticValue key='FailedTestCount' value='" + data.failures.length + "']"); | ||
console.log("##teamcity[blockClosed name='Code Coverage Summary']"); | ||
|
||
if (cov >= threshold) { | ||
console.log("##teamcity[message text='CODE-COVERAGE CHECK PASSED' status='NORMAL']"); | ||
} else { | ||
console.log("##teamcity[message text='CODE-COVERAGE CHECK FAILED' errorDetails='Insufficient code coverage.' status='ERROR']"); | ||
} | ||
|
||
}.bind(this)); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
{ | ||
"name": "mocha-teamcity-reporter", | ||
"version": "0.0.2", | ||
"description": "teamcity reporter for mocha", | ||
"name": "mocha-teamcity-cov-reporter", | ||
"version": "0.0.1", | ||
"description": "teamcity code coverage reporter for mocha", | ||
"main": "index.js", | ||
"directories": "./lib", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/travisjeffery/mocha-teamcity-reporter.git" | ||
"url": "https://github.com/cmcleod/mocha-teamcity-cov-reporter.git" | ||
}, | ||
"keywords": [ | ||
"mocha", | ||
"teamcity", | ||
"reporter", | ||
"jetbrains" | ||
"coverage" | ||
], | ||
"dependencies": { | ||
"mocha": ">=1.13.0" | ||
}, | ||
"author": "travis jeffery", | ||
"author": "Colin McLeod", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/travisjeffery/mocha-teamcity-reporter/issues" | ||
"url": "https://github.com/cmcleod/mocha-teamcity-cov-reporter/issues" | ||
} | ||
} |