fix #17, now computing coverage result correctly

This commit is contained in:
2017-03-31 19:18:18 +02:00
parent 95ba650a14
commit 50e2895ad9
16 changed files with 175 additions and 268 deletions

17
dist/mod02/index.js vendored
View File

@ -62,7 +62,7 @@ let tap = function (configArg) {
testableFilesSmartstream.run(),
testFilesSmartstream.run()
]).then(() => __awaiter(this, void 0, void 0, function* () {
yield npmtsTapBuffer.runTests();
configArg.runData.coverageLcovInfo = yield npmtsTapBuffer.runTests();
done.resolve(configArg);
}), (err) => {
plugins.beautylog.error('Tests failed!');
@ -76,15 +76,15 @@ let tap = function (configArg) {
});
return done.promise;
};
let handleCoverageData = function (configArg) {
let done = q.defer();
if (71 >= configArg.coverageTreshold) {
plugins.beautylog.ok(`${(71).toString()}% `
let handleCoverageData = (configArg) => __awaiter(this, void 0, void 0, function* () {
let coverageResult = yield plugins.smartcov.get.percentageFromLcovString(configArg.runData.coverageLcovInfo, 2);
if (coverageResult >= configArg.coverageTreshold) {
plugins.beautylog.ok(`${(coverageResult).toString()}% `
+ `coverage exceeds your treshold of `
+ `${configArg.coverageTreshold.toString()}%`);
}
else {
plugins.beautylog.warn(`${(71).toString()}% `
plugins.beautylog.warn(`${(coverageResult).toString()}% `
+ `coverage fails your treshold of `
+ `${configArg.coverageTreshold.toString()}%`);
plugins.beautylog.error('exiting due to coverage failure');
@ -92,9 +92,8 @@ let handleCoverageData = function (configArg) {
process.exit(1);
}
}
done.resolve(configArg);
return done.promise;
};
return configArg;
});
exports.run = function (configArg) {
let done = q.defer();
let config = configArg;

View File

@ -3,5 +3,6 @@ import * as gulp from 'gulp';
import * as gulpFunction from 'gulp-function';
import * as gulpSourcemaps from 'gulp-sourcemaps';
import * as gulpTypeScript from 'gulp-typescript';
import * as smartcov from 'smartcov';
import * as tapbuffer from 'tapbuffer';
export { gulp, gulpFunction, gulpSourcemaps, gulpTypeScript, tapbuffer };
export { gulp, gulpFunction, gulpSourcemaps, gulpTypeScript, smartcov, tapbuffer };

View File

@ -12,5 +12,7 @@ const gulpSourcemaps = require("gulp-sourcemaps");
exports.gulpSourcemaps = gulpSourcemaps;
const gulpTypeScript = require("gulp-typescript");
exports.gulpTypeScript = gulpTypeScript;
const smartcov = require("smartcov");
exports.smartcov = smartcov;
const tapbuffer = require("tapbuffer");
exports.tapbuffer = tapbuffer;