improve coverage reporting

This commit is contained in:
Philipp Kunz 2016-07-23 02:05:56 +02:00
parent 63c73536a2
commit ee16740d0b
5 changed files with 10 additions and 14 deletions

View File

@ -19,7 +19,7 @@ export import Q = require("q");
export import shelljs = require("shelljs"); export import shelljs = require("shelljs");
export declare let smartci: any; export declare let smartci: any;
export import smartcli = require("smartcli"); export import smartcli = require("smartcli");
export declare let smartcov: any; export import smartcov = require("smartcov");
export import smartenv = require("smartenv"); export import smartenv = require("smartenv");
export import smartfile = require("smartfile"); export import smartfile = require("smartfile");
export import smartpath = require("smartpath"); export import smartpath = require("smartpath");

8
dist/npmts.tests.js vendored
View File

@ -43,15 +43,13 @@ var mocha = function (configArg) {
}; };
var coverage = function (configArg) { var coverage = function (configArg) {
var done = plugins.Q.defer(); var done = plugins.Q.defer();
plugins.smartcov.get.percentage(plugins.path.join(paths.coverageDir, "lcov.info")) plugins.smartcov.get.percentage(plugins.path.join(paths.coverageDir, "lcov.info"), 2)
.then(function (percentageArg) { .then(function (percentageArg) {
if (percentageArg >= configArg.coverageTreshold) { if (percentageArg >= configArg.coverageTreshold) {
plugins.beautylog.ok("your coverage of " + percentageArg.toString().blue + "% ".blue + "exceeds your treshold of " + plugins.beautylog.ok(percentageArg.toString() + "% coverage exceeds your treshold of " + configArg.coverageTreshold.toString() + "%");
configArg.coverageTreshold.toString().blue + "%".blue);
} }
else { else {
plugins.beautylog.warn("your coverage of " + percentageArg + "% " + "fails your treshold of " + plugins.beautylog.warn(percentageArg.toString() + "% coverage fails your treshold of " + configArg.coverageTreshold.toString() + "%");
configArg.coverageTreshold + "%");
plugins.beautylog.error("exiting due to coverage failure"); plugins.beautylog.error("exiting due to coverage failure");
process.exit(1); process.exit(1);
} }

View File

@ -50,10 +50,10 @@
"npmextra": "^1.0.8", "npmextra": "^1.0.8",
"projectinfo": "1.0.3", "projectinfo": "1.0.3",
"q": "^1.4.1", "q": "^1.4.1",
"shelljs": "^0.7.0", "shelljs": "^0.7.1",
"smartci": "0.0.1", "smartci": "0.0.1",
"smartcli": "1.0.4", "smartcli": "1.0.4",
"smartcov": "0.0.6", "smartcov": "0.0.9",
"smartenv": "1.2.5", "smartenv": "1.2.5",
"smartfile": "4.0.12", "smartfile": "4.0.12",
"smartpath": "3.2.2", "smartpath": "3.2.2",

View File

@ -19,7 +19,7 @@ export import Q = require("q");
export import shelljs = require("shelljs"); export import shelljs = require("shelljs");
export let smartci = require("smartci"); export let smartci = require("smartci");
export import smartcli = require("smartcli"); export import smartcli = require("smartcli");
export let smartcov = require("smartcov"); export import smartcov = require("smartcov");
export import smartenv = require("smartenv"); export import smartenv = require("smartenv");
export import smartfile = require("smartfile"); export import smartfile = require("smartfile");
export import smartpath = require("smartpath"); export import smartpath = require("smartpath");

View File

@ -45,17 +45,15 @@ let mocha = function (configArg) {
let coverage = function(configArg){ let coverage = function(configArg){
let done = plugins.Q.defer(); let done = plugins.Q.defer();
plugins.smartcov.get.percentage(plugins.path.join(paths.coverageDir,"lcov.info")) plugins.smartcov.get.percentage(plugins.path.join(paths.coverageDir,"lcov.info"),2)
.then(function(percentageArg){ .then(function(percentageArg){
if (percentageArg >= configArg.coverageTreshold){ if (percentageArg >= configArg.coverageTreshold){
plugins.beautylog.ok( plugins.beautylog.ok(
"your coverage of " + percentageArg.toString().blue + "% ".blue + "exceeds your treshold of " + `${percentageArg.toString()}% coverage exceeds your treshold of ${configArg.coverageTreshold.toString()}%`
configArg.coverageTreshold.toString().blue + "%".blue
); );
} else { } else {
plugins.beautylog.warn( plugins.beautylog.warn(
"your coverage of " + percentageArg + "% " + "fails your treshold of " + `${percentageArg.toString()}% coverage fails your treshold of ${configArg.coverageTreshold.toString()}%`
configArg.coverageTreshold + "%"
); );
plugins.beautylog.error("exiting due to coverage failure"); plugins.beautylog.error("exiting due to coverage failure");
process.exit(1); process.exit(1);