now looking for coverage percentage being actually present, fixes #22

This commit is contained in:
Philipp Kunz 2017-05-05 00:01:21 +02:00
parent 4b07c9951f
commit 46c79e711b
4 changed files with 118 additions and 106 deletions

View File

@ -85,7 +85,7 @@ let checkDevDependencies = (configArg) => {
plugins.beautylog.log(`unused devDependency ${item}`); plugins.beautylog.log(`unused devDependency ${item}`);
} }
for (let item in unused.missing) { for (let item in unused.missing) {
plugins.beautylog.error(`unused devDependency ${item}`); plugins.beautylog.error(`missing devDependency ${item}`);
} }
if (unused.missing.length > 0) { if (unused.missing.length > 0) {
plugins.beautylog.info('exiting due to missing dependencies in package.json'); plugins.beautylog.info('exiting due to missing dependencies in package.json');

8
dist/mod02/index.js vendored
View File

@ -77,7 +77,13 @@ let tap = function (configArg) {
return done.promise; return done.promise;
}; };
let handleCoverageData = (configArg) => __awaiter(this, void 0, void 0, function* () { let handleCoverageData = (configArg) => __awaiter(this, void 0, void 0, function* () {
let coverageResult = yield plugins.smartcov.get.percentageFromLcovString(configArg.runData.coverageLcovInfo, 2); let coverageResult = 0; // the coverage in percent
if (configArg.runData.coverageLcovInfo) {
coverageResult = yield plugins.smartcov.get.percentageFromLcovString(configArg.runData.coverageLcovInfo, 2);
}
else {
plugins.beautylog.warn('Hey... Did your tests import and use your module that you are trying to test?');
}
if (coverageResult >= configArg.coverageTreshold) { if (coverageResult >= configArg.coverageTreshold) {
plugins.beautylog.ok(`${(coverageResult).toString()}% ` plugins.beautylog.ok(`${(coverageResult).toString()}% `
+ `coverage exceeds your treshold of ` + `coverage exceeds your treshold of `

View File

@ -89,7 +89,7 @@ let checkDevDependencies = (configArg) => {
plugins.beautylog.log(`unused devDependency ${item}`) plugins.beautylog.log(`unused devDependency ${item}`)
} }
for (let item in unused.missing) { for (let item in unused.missing) {
plugins.beautylog.error(`unused devDependency ${item}`) plugins.beautylog.error(`missing devDependency ${item}`)
} }
if (unused.missing.length > 0) { if (unused.missing.length > 0) {
plugins.beautylog.info('exiting due to missing dependencies in package.json') plugins.beautylog.info('exiting due to missing dependencies in package.json')

View File

@ -77,10 +77,16 @@ let tap = function (configArg: INpmtsConfig) {
} }
let handleCoverageData = async (configArg: INpmtsConfig) => { let handleCoverageData = async (configArg: INpmtsConfig) => {
let coverageResult = await plugins.smartcov.get.percentageFromLcovString( let coverageResult: number = 0 // the coverage in percent
if (configArg.runData.coverageLcovInfo) {
coverageResult = await plugins.smartcov.get.percentageFromLcovString(
configArg.runData.coverageLcovInfo, configArg.runData.coverageLcovInfo,
2 2
) )
} else {
plugins.beautylog.warn('Hey... Did your tests import and use your module that you are trying to test?')
}
if (coverageResult >= configArg.coverageTreshold) { if (coverageResult >= configArg.coverageTreshold) {
plugins.beautylog.ok( plugins.beautylog.ok(
`${(coverageResult).toString()}% ` `${(coverageResult).toString()}% `