Switch to nyc, babel-plugin-istanbul & codecov-node for code coverage (#4885)

* Switch to nyc, babel-plugin-istanbul & codecov-node for code coverage

This setup (very much like Babylon's) let us trace code coverage back to the `src/` directories of packages.

* Exclude package tests from coverage report

* fix: upgrade to version of nyc that tweaks a couple more things for babel

* fix: remove comment based on @hzoo's review
This commit is contained in:
Benjamin E. Coe
2016-11-28 11:17:52 -08:00
committed by Henry Zhu
parent f98d824ae7
commit db67d7fdce
6 changed files with 32 additions and 20 deletions

View File

@@ -9,7 +9,6 @@ var gulp = require("gulp");
var path = require("path");
var scripts = "./packages/*/src/**/*.js";
var dest = "packages";
var srcEx, libFragment;
@@ -21,6 +20,9 @@ if (path.win32 === path) {
libFragment = "$1/lib/";
}
var mapToDest = function (path) { return path.replace(srcEx, libFragment); };
var dest = "packages";
gulp.task("default", ["build"]);
gulp.task("build", function () {
@@ -30,17 +32,17 @@ gulp.task("build", function () {
gutil.log(err.stack);
}
}))
.pipe(newer({map: mapToDest}))
.pipe(through.obj(function (file, enc, callback) {
file._path = file.path;
file.path = file.path.replace(srcEx, libFragment);
callback(null, file);
}))
.pipe(newer(dest))
.pipe(through.obj(function (file, enc, callback) {
gutil.log("Compiling", "'" + chalk.cyan(file._path) + "'...");
gutil.log("Compiling", "'" + chalk.cyan(file.path) + "'...");
callback(null, file);
}))
.pipe(babel())
.pipe(through.obj(function (file, enc, callback) {
file._path = file.path;
file.path = mapToDest(file.path);
callback(null, file);
}))
.pipe(gulp.dest(dest));
});