fix istanbul
This commit is contained in:
4
dist/npmts.plugins.d.ts
vendored
4
dist/npmts.plugins.d.ts
vendored
@@ -2,8 +2,10 @@ import "typings-global";
|
||||
export import beautylog = require("beautylog");
|
||||
export declare let gulp: any;
|
||||
export declare let g: {
|
||||
babel: any;
|
||||
babelIstanbul: any;
|
||||
gFunction: any;
|
||||
istanbul: any;
|
||||
injectModules: any;
|
||||
mocha: any;
|
||||
replace: any;
|
||||
sourcemaps: any;
|
||||
|
4
dist/npmts.plugins.js
vendored
4
dist/npmts.plugins.js
vendored
@@ -3,8 +3,10 @@ require("typings-global");
|
||||
exports.beautylog = require("beautylog");
|
||||
exports.gulp = require("gulp");
|
||||
exports.g = {
|
||||
babel: require("gulp-babel"),
|
||||
babelIstanbul: require("gulp-babel-istanbul"),
|
||||
gFunction: require("gulp-function"),
|
||||
istanbul: require("gulp-istanbul"),
|
||||
injectModules: require("gulp-inject-modules"),
|
||||
mocha: require("gulp-mocha"),
|
||||
replace: require("gulp-replace"),
|
||||
sourcemaps: require("gulp-sourcemaps"),
|
||||
|
43
dist/npmts.tests.js
vendored
43
dist/npmts.tests.js
vendored
@@ -7,34 +7,26 @@ var npmts_promisechain_1 = require("./npmts.promisechain");
|
||||
*
|
||||
* @returns {*}
|
||||
*/
|
||||
var istanbul = function (configArg) {
|
||||
npmts_promisechain_1.npmtsOra.text("Instrumentalizing transpiled JS...");
|
||||
var mocha = function (configArg) {
|
||||
npmts_promisechain_1.npmtsOra.text("Instrumentalizing and testing transpiled JS");
|
||||
npmts_promisechain_1.npmtsOra.end(); // end npmtsOra for tests.
|
||||
var done = plugins.Q.defer();
|
||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "dist/*.js")])
|
||||
.pipe(plugins.g.sourcemaps.init())
|
||||
.pipe(plugins.g.istanbul()) // Covering files
|
||||
.pipe(plugins.g.babelIstanbul())
|
||||
.pipe(plugins.g.babelIstanbul.hookRequire())
|
||||
.pipe(plugins.g.sourcemaps.write())
|
||||
.pipe(plugins.g.istanbul.hookRequire()) // Force `require` to return covered files
|
||||
.pipe(plugins.g.gFunction(function () {
|
||||
plugins.beautylog.ok("JS has been instrumentalized to get test code coverage!");
|
||||
done.resolve(configArg);
|
||||
}, "atEnd"));
|
||||
return done.promise;
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @returns {*}
|
||||
*/
|
||||
var mocha = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
npmts_promisechain_1.npmtsOra.end(); // end npmtsOra for tests.
|
||||
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"));
|
||||
.on("finish", function () {
|
||||
plugins.gulp.src([plugins.path.join(paths.cwd, "dist/*.js")])
|
||||
.pipe(plugins.g.babel())
|
||||
.pipe(plugins.g.injectModules())
|
||||
.pipe(plugins.g.mocha())
|
||||
.pipe(plugins.g.babelIstanbul.writeReports())
|
||||
.pipe(plugins.g.gFunction(function () {
|
||||
plugins.beautylog.ok("Tested!");
|
||||
done.resolve(configArg);
|
||||
}, "atEnd"));
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
var coverage = function (configArg) {
|
||||
@@ -63,8 +55,7 @@ exports.run = function (configArg) {
|
||||
plugins.beautylog.log("-------------------------------------------------------\n" +
|
||||
"*************************** TESTS: ***************************\n" +
|
||||
"--------------------------------------------------------------");
|
||||
istanbul(config)
|
||||
.then(mocha)
|
||||
mocha(config)
|
||||
.then(coverage)
|
||||
.then(function () {
|
||||
done.resolve(config);
|
||||
|
Reference in New Issue
Block a user