now has better coverage failure
This commit is contained in:
parent
5b0814520a
commit
58043d0fa2
1
dist/npmts.options.js
vendored
1
dist/npmts.options.js
vendored
@ -33,6 +33,7 @@ exports.run = function (configArg) {
|
||||
// handle coveralls
|
||||
config.coveralls ? void (0) : config.coveralls = false;
|
||||
exports.doPublish() ? void (0) : config.coveralls = false;
|
||||
config.coverageTreshold ? void (0) : config.coverageTreshold = 70;
|
||||
// handle docs
|
||||
config.docs ? void (0) : config.docs = {};
|
||||
config.docs.publish ? void (0) : config.docs.publish = false;
|
||||
|
1
dist/npmts.paths.js
vendored
1
dist/npmts.paths.js
vendored
@ -8,6 +8,7 @@ paths.tsDir = plugins.path.join(paths.cwd, "ts/");
|
||||
paths.distDir = plugins.path.join(paths.cwd, "dist/");
|
||||
paths.docsDir = plugins.path.join(paths.cwd, "docs/");
|
||||
paths.testDir = plugins.path.join(paths.cwd, "test/");
|
||||
paths.coverageDir = plugins.path.join(paths.cwd, "coverage/");
|
||||
paths.npmtsAssetsDir = plugins.path.join(__dirname, "../assets/");
|
||||
//Files
|
||||
paths.indexTS = plugins.path.join(paths.cwd, "ts/index.ts");
|
||||
|
1
dist/npmts.plugins.js
vendored
1
dist/npmts.plugins.js
vendored
@ -21,6 +21,7 @@ exports.Q = require("q");
|
||||
exports.shelljs = require("shelljs");
|
||||
exports.smartci = require("smartci");
|
||||
exports.smartcli = require("smartcli");
|
||||
exports.smartcov = require("smartcov");
|
||||
exports.smartenv = require("smartenv");
|
||||
exports.smartfile = require("smartfile");
|
||||
exports.smartpath = require("smartpath");
|
||||
|
70
dist/npmts.tests.js
vendored
70
dist/npmts.tests.js
vendored
@ -13,33 +13,65 @@ exports.publishCoverage = function (configArg) {
|
||||
}, "atEnd"));
|
||||
return done.promise;
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @returns {*}
|
||||
*/
|
||||
var istanbul = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "dist/*.js")])
|
||||
.pipe(plugins.g.istanbul()) // Covering files
|
||||
.pipe(plugins.g.istanbul.hookRequire()) // Force `require` to return covered files
|
||||
.pipe(plugins.g.gFunction(function () {
|
||||
done.resolve(configArg);
|
||||
}, "atEnd"));
|
||||
return done.promise;
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @returns {*}
|
||||
*/
|
||||
var mocha = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var stream = plugins.gulp.src(["./test/test.js"])
|
||||
.pipe(plugins.g.mocha())
|
||||
.pipe(plugins.g.istanbul.writeReports()) // Creating the reports after tests ran
|
||||
.pipe(plugins.g.gFunction(function () {
|
||||
plugins.beautylog.ok("Tests have passed!");
|
||||
done.resolve(configArg);
|
||||
}, "atEnd"));
|
||||
return done.promise;
|
||||
};
|
||||
var coverage = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
plugins.smartcov.get.percentage(plugins.path.join(paths.coverageDir, "lcov.info"))
|
||||
.then(function (percentageArg) {
|
||||
if (percentageArg >= configArg.coverageTreshold) {
|
||||
plugins.beautylog.ok("your coverage of " + percentageArg + "% " + "is within your treshold of " +
|
||||
configArg.coverageTreshold + "%");
|
||||
}
|
||||
else {
|
||||
plugins.beautylog.warn("your coverage of " + percentageArg + "% " + "fails your treshold of " +
|
||||
configArg.coverageTreshold + "%");
|
||||
plugins.beautylog.error("exiting due to coverage failure");
|
||||
process.exit(1);
|
||||
}
|
||||
done.resolve(configArg);
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
exports.run = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
var istanbul = function () {
|
||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "dist/*.js")])
|
||||
.pipe(plugins.g.istanbul())
|
||||
.pipe(plugins.g.istanbul.hookRequire());
|
||||
return stream;
|
||||
};
|
||||
var mocha = function () {
|
||||
var stream = plugins.gulp.src(["./test/test.js"])
|
||||
.pipe(plugins.g.mocha())
|
||||
.pipe(plugins.g.istanbul.writeReports())
|
||||
.pipe(plugins.g.istanbul.enforceThresholds({ thresholds: { global: 30 } }));
|
||||
return stream;
|
||||
};
|
||||
plugins.beautylog.log("now starting tests");
|
||||
console.log("--------------------------------------------------------------\n" +
|
||||
"***************************" +
|
||||
" TESTS: ".blue +
|
||||
"***************************\n" +
|
||||
"--------------------------------------------------------------");
|
||||
istanbul().on("finish", function () {
|
||||
mocha().on("finish", function () {
|
||||
plugins.beautylog.ok("Tests have passed!");
|
||||
done.resolve(config);
|
||||
});
|
||||
});
|
||||
istanbul(config)
|
||||
.then(mocha)
|
||||
.then(coverage)
|
||||
.then(done.resolve);
|
||||
return done.promise;
|
||||
};
|
||||
|
@ -30,7 +30,7 @@
|
||||
"gulp": "3.9.1",
|
||||
"gulp-concat": "^2.6.0",
|
||||
"gulp-coveralls": "^0.1.4",
|
||||
"gulp-function": "^1.1.1",
|
||||
"gulp-function": "^1.2.0",
|
||||
"gulp-if": "^2.0.0",
|
||||
"gulp-istanbul": "^0.10.3",
|
||||
"gulp-jsdoc3": "^0.2.1",
|
||||
@ -44,9 +44,10 @@
|
||||
"shelljs": "^0.6.0",
|
||||
"smartci": "0.0.1",
|
||||
"smartcli": "0.0.11",
|
||||
"smartcov": "0.0.3",
|
||||
"smartenv": "1.2.0",
|
||||
"smartfile": "2.2.0",
|
||||
"smartpath": "3.0.1",
|
||||
"smartpath": "3.0.3",
|
||||
"source-map-support": "^0.4.0"
|
||||
},
|
||||
"devDependencies": {}
|
||||
|
2
test/assets/dist/index.js
vendored
2
test/assets/dist/index.js
vendored
@ -6,4 +6,4 @@ var testplugin = {
|
||||
};
|
||||
module.exports = testplugin;
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDRDQUE0QztBQUM1QyxJQUFJLFVBQVUsR0FBRztJQUNiLFlBQVksRUFBRTtR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jsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
|
||||
|
2
test/assets/test/test.d.ts
vendored
2
test/assets/test/test.d.ts
vendored
@ -1,2 +0,0 @@
|
||||
/// <reference path="../ts/typings/main.d.ts" />
|
||||
declare var testplugin: any;
|
@ -7,4 +7,5 @@ describe("testplugins", function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=test.js.map
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksVUFBVSxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzdDLFFBQVEsQ0FBQyxhQUFhLEVBQUM7SUFDbkIsUUFBUSxDQUFDLGVBQWUsRUFBQztRQUNyQixFQUFFLENBQUMsc0JBQXNCLEVBQUM7WUFDdEIsVUFBVSxDQUFDLFlBQVksRUFBRSxDQUFBO1FBQzdCLENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQyxDQUFDLENBQUM7QUFDUCxDQUFDLENBQUMsQ0FBQyIsImZpbGUiOiJ0ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4uL3RzL3R5cGluZ3MvbWFpbi5kLnRzXCIgLz5cbnZhciB0ZXN0cGx1Z2luID0gcmVxdWlyZShcIi4uL2Rpc3QvaW5kZXguanNcIik7XG5kZXNjcmliZShcInRlc3RwbHVnaW5zXCIsZnVuY3Rpb24oKXtcbiAgICBkZXNjcmliZShcIi5sb2dTb21ldGhpbmdcIixmdW5jdGlvbigpe1xuICAgICAgICBpdChcInNob3VsZCBsb2cgc29tZXRoaW5nXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIHRlc3RwbHVnaW4ubG9nU29tZXRoaW5nKClcbiAgICAgICAgfSk7XG4gICAgfSk7XG59KTsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
|
||||
|
@ -1,5 +1,5 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var testplugin = {
|
||||
let testplugin = {
|
||||
logSomething: function(){
|
||||
console.log("only function executed");
|
||||
}
|
||||
|
@ -40,6 +40,8 @@ export var run = function(configArg){
|
||||
config.coveralls ? void(0) : config.coveralls = false;
|
||||
doPublish() ? void(0) : config.coveralls = false;
|
||||
|
||||
config.coverageTreshold ? void(0) : config.coverageTreshold = 70;
|
||||
|
||||
// handle docs
|
||||
config.docs ? void(0) : config.docs = {};
|
||||
config.docs.publish ? void(0) : config.docs.publish = false;
|
||||
|
@ -8,6 +8,7 @@ paths.tsDir = plugins.path.join(paths.cwd,"ts/");
|
||||
paths.distDir = plugins.path.join(paths.cwd,"dist/");
|
||||
paths.docsDir = plugins.path.join(paths.cwd,"docs/");
|
||||
paths.testDir = plugins.path.join(paths.cwd,"test/");
|
||||
paths.coverageDir = plugins.path.join(paths.cwd,"coverage/");
|
||||
|
||||
paths.npmtsAssetsDir = plugins.path.join(__dirname,"../assets/");
|
||||
|
||||
|
@ -21,6 +21,7 @@ export let Q = require("q");
|
||||
export let shelljs = require("shelljs");
|
||||
export let smartci = require("smartci");
|
||||
export let smartcli = require("smartcli");
|
||||
export let smartcov = require("smartcov");
|
||||
export let smartenv = require("smartenv");
|
||||
export let smartfile = require("smartfile");
|
||||
export let smartpath = require("smartpath");
|
@ -8,7 +8,6 @@ import NpmtsJsdoc = require("./npmts.jsdoc");
|
||||
export let run = function(configArg){
|
||||
let done = plugins.Q.defer();
|
||||
let config = configArg;
|
||||
|
||||
let promiseArray = [];
|
||||
config.coveralls ? promiseArray.push(NpmtsTests.publishCoverage(configArg)) : void(0);
|
||||
config.docs.publish ? promiseArray.push(NpmtsJsdoc.publishDocs(configArg)) : void(0);
|
||||
|
@ -14,27 +14,62 @@ export let publishCoverage = function(configArg){
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
export var run = function(configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
var istanbul = function () {
|
||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"dist/*.js")])
|
||||
// Covering files
|
||||
.pipe(plugins.g.istanbul())
|
||||
// Force `require` to return covered files
|
||||
.pipe(plugins.g.istanbul.hookRequire());
|
||||
return stream;
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @returns {*}
|
||||
*/
|
||||
let istanbul = function (configArg) {
|
||||
let done = plugins.Q.defer();
|
||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"dist/*.js")])
|
||||
.pipe(plugins.g.istanbul()) // Covering files
|
||||
.pipe(plugins.g.istanbul.hookRequire()) // Force `require` to return covered files
|
||||
.pipe(plugins.g.gFunction(function(){
|
||||
done.resolve(configArg);
|
||||
},"atEnd"));
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
var mocha = function () {
|
||||
var stream = plugins.gulp.src(["./test/test.js"])
|
||||
.pipe(plugins.g.mocha())
|
||||
// Creating the reports after tests ran
|
||||
.pipe(plugins.g.istanbul.writeReports())
|
||||
// Enforce a coverage of at least 90%
|
||||
.pipe(plugins.g.istanbul.enforceThresholds({ thresholds: { global: 30 } }));
|
||||
return stream;
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @returns {*}
|
||||
*/
|
||||
let mocha = function (configArg) {
|
||||
let done = plugins.Q.defer();
|
||||
let stream = plugins.gulp.src(["./test/test.js"])
|
||||
.pipe(plugins.g.mocha())
|
||||
.pipe(plugins.g.istanbul.writeReports()) // Creating the reports after tests ran
|
||||
.pipe(plugins.g.gFunction(function(){
|
||||
plugins.beautylog.ok("Tests have passed!");
|
||||
done.resolve(configArg);
|
||||
},"atEnd"));
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
let coverage = function(configArg){
|
||||
let done = plugins.Q.defer();
|
||||
plugins.smartcov.get.percentage(plugins.path.join(paths.coverageDir,"lcov.info"))
|
||||
.then(function(percentageArg){
|
||||
if (percentageArg >= configArg.coverageTreshold){
|
||||
plugins.beautylog.ok(
|
||||
"your coverage of " + percentageArg + "% " + "is within your treshold of " +
|
||||
configArg.coverageTreshold + "%"
|
||||
);
|
||||
} else {
|
||||
plugins.beautylog.warn(
|
||||
"your coverage of " + percentageArg + "% " + "fails your treshold of " +
|
||||
configArg.coverageTreshold + "%"
|
||||
);
|
||||
plugins.beautylog.error("exiting due to coverage failure");
|
||||
process.exit(1);
|
||||
}
|
||||
done.resolve(configArg);
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
export let run = function(configArg) {
|
||||
let done = plugins.Q.defer();
|
||||
let config = configArg;
|
||||
|
||||
plugins.beautylog.log("now starting tests");
|
||||
console.log(
|
||||
@ -44,11 +79,10 @@ export var run = function(configArg) {
|
||||
"***************************\n" +
|
||||
"--------------------------------------------------------------"
|
||||
);
|
||||
istanbul().on("finish",function(){
|
||||
mocha().on("finish",function(){
|
||||
plugins.beautylog.ok("Tests have passed!");
|
||||
done.resolve(config);
|
||||
})
|
||||
});
|
||||
|
||||
istanbul(config)
|
||||
.then(mocha)
|
||||
.then(coverage)
|
||||
.then(done.resolve);
|
||||
return done.promise;
|
||||
};
|
@ -1,7 +1,8 @@
|
||||
{
|
||||
"ambientDependencies": {
|
||||
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777",
|
||||
"colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts#09e37435ffb2c56a6f908081194a74756f24f99d",
|
||||
"istanbul": "registry:dt/istanbul#0.4.0+20160316155526",
|
||||
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777",
|
||||
"vinyl": "github:DefinitelyTyped/DefinitelyTyped/vinyl/vinyl.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user