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"),
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										35
									
								
								dist/npmts.tests.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										35
									
								
								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"])
 | 
			
		||||
        .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.istanbul.writeReports()) // Creating the reports after tests ran
 | 
			
		||||
            .pipe(plugins.g.babelIstanbul.writeReports())
 | 
			
		||||
            .pipe(plugins.g.gFunction(function () {
 | 
			
		||||
        plugins.beautylog.ok("Tests have passed!");
 | 
			
		||||
            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);
 | 
			
		||||
 
 | 
			
		||||
@@ -36,11 +36,12 @@
 | 
			
		||||
    "early": "^2.0.13",
 | 
			
		||||
    "esdoc": "^0.4.7",
 | 
			
		||||
    "gulp": "3.9.1",
 | 
			
		||||
    "gulp-babel": "^6.1.2",
 | 
			
		||||
    "gulp-babel-istanbul": "^1.4.0",
 | 
			
		||||
    "gulp-concat": "^2.6.0",
 | 
			
		||||
    "gulp-function": "^1.3.6",
 | 
			
		||||
    "gulp-if": "^2.0.1",
 | 
			
		||||
    "gulp-istanbul": "^1.0.0",
 | 
			
		||||
    "gulp-jsdoc3": "^0.3.0",
 | 
			
		||||
    "gulp-inject-modules": "^1.0.0",
 | 
			
		||||
    "gulp-mocha": "^2.2.0",
 | 
			
		||||
    "gulp-replace": "^0.5.4",
 | 
			
		||||
    "gulp-sourcemaps": "^1.6.0",
 | 
			
		||||
 
 | 
			
		||||
@@ -2,8 +2,10 @@ import "typings-global";
 | 
			
		||||
export import beautylog = require("beautylog");
 | 
			
		||||
export let gulp = require("gulp");
 | 
			
		||||
export let 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"),
 | 
			
		||||
 
 | 
			
		||||
@@ -7,35 +7,26 @@ import {npmtsOra} from "./npmts.promisechain";
 | 
			
		||||
 *
 | 
			
		||||
 * @returns {*}
 | 
			
		||||
 */
 | 
			
		||||
let istanbul = function (configArg) {
 | 
			
		||||
    npmtsOra.text("Instrumentalizing transpiled JS...");
 | 
			
		||||
let mocha = function (configArg) {
 | 
			
		||||
    npmtsOra.text("Instrumentalizing and testing transpiled JS");
 | 
			
		||||
    npmtsOra.end(); // end npmtsOra for tests.
 | 
			
		||||
    let 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 {*}
 | 
			
		||||
 */
 | 
			
		||||
let mocha = function (configArg) {
 | 
			
		||||
    let done = plugins.Q.defer();
 | 
			
		||||
    npmtsOra.end(); // end npmtsOra for tests.
 | 
			
		||||
    let stream = plugins.gulp.src(["./test/test.js"])
 | 
			
		||||
        .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.istanbul.writeReports()) // Creating the reports after tests ran
 | 
			
		||||
            .pipe(plugins.g.babelIstanbul.writeReports())
 | 
			
		||||
            .pipe(plugins.g.gFunction(function(){
 | 
			
		||||
            plugins.beautylog.ok("Tests have passed!");
 | 
			
		||||
                plugins.beautylog.ok("Tested!");
 | 
			
		||||
                done.resolve(configArg);
 | 
			
		||||
            },"atEnd"));
 | 
			
		||||
        });
 | 
			
		||||
    return done.promise;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -72,8 +63,7 @@ export let run = function(configArg) {
 | 
			
		||||
            "--------------------------------------------------------------"
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        istanbul(config)
 | 
			
		||||
            .then(mocha)
 | 
			
		||||
        mocha(config)
 | 
			
		||||
            .then(coverage)
 | 
			
		||||
            .then(() => {
 | 
			
		||||
                done.resolve(config);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user