Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ dist
/packages/*/lib
_babel.github.io
/tests/.browser-build.js
/.nyc_output
5 changes: 0 additions & 5 deletions .istanbul.yml

This file was deleted.

14 changes: 8 additions & 6 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ var gulp = require("gulp");
var path = require("path");

var scripts = "./packages/*/src/**/*.js";
var dest = "packages";

var srcEx, libFragment;

Expand All @@ -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 () {
Expand All @@ -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);
gutil.log("Compiling", "'" + chalk.cyan(file.path) + "'...");
callback(null, file);
}))
.pipe(newer(dest))
.pipe(babel())
.pipe(through.obj(function (file, enc, callback) {
gutil.log("Compiling", "'" + chalk.cyan(file._path) + "'...");
file._path = file.path;
file.path = mapToDest(file.path);
callback(null, file);
}))
.pipe(babel())
.pipe(gulp.dest(dest));
});

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ test: lint test-only
test-cov: clean
# rebuild with test
rm -rf packages/*/lib
BABEL_ENV=test; ./node_modules/.bin/gulp build
BABEL_ENV=test ./node_modules/.bin/gulp build
./scripts/test-cov.sh

test-ci:
NODE_ENV=test make bootstrap
# if ./node_modules/.bin/semver `npm --version` -r ">=3.3.0"; then ./node_modules/.bin/flow check; fi
./scripts/test-cov.sh
cat ./coverage/coverage.json | ./node_modules/codecov.io/bin/codecov.io.js
make test-cov
./node_modules/.bin/codecov -f coverage/coverage-final.json

publish:
git pull --rebase
Expand Down
19 changes: 16 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"async": "^1.5.0",
"babel-core": "^6.13.2",
"babel-eslint": "^7.0.0",
"babel-plugin-istanbul": "^2.0.1",
"babel-plugin-transform-class-properties": "^6.6.0",
"babel-plugin-transform-flow-strip-types": "^6.3.13",
"babel-plugin-transform-runtime": "^6.3.13",
Expand All @@ -22,7 +23,7 @@
"bundle-collapser": "^1.2.1",
"chai": "^3.5.0",
"chalk": "1.1.1",
"codecov.io": "^0.1.6",
"codecov": "^1.0.1",
"derequire": "^2.0.2",
"eslint": "^3.7.1",
"eslint-config-babel": "^2.0.1",
Expand All @@ -35,11 +36,11 @@
"gulp-plumber": "^1.0.1",
"gulp-util": "^3.0.7",
"gulp-watch": "^4.3.5",
"istanbul": "^0.4.5",
"lerna": "2.0.0-beta.23",
"lerna-changelog": "^0.2.0",
"lodash": "^4.2.0",
"mocha": "^3.0.0",
"nyc": "^8.3.1",
"output-file-sync": "^1.1.1",
"rimraf": "^2.4.3",
"semver": "^5.0.0",
Expand All @@ -65,8 +66,20 @@
],
"env": {
"test": {
"auxiliaryCommentBefore": "istanbul ignore next"
"auxiliaryCommentBefore": "istanbul ignore next",
"plugins": [
"istanbul"
]
}
}
},
"nyc": {
"exclude": [
"**/node_modules/**",
"scripts/*.js",
"packages/*/test/**"
],
"sourceMap": false,
"instrument": false
}
}
3 changes: 2 additions & 1 deletion scripts/test-cov.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
set -e

node node_modules/istanbul/lib/cli.js cover node_modules/mocha/bin/_mocha -- `scripts/_get-test-directories.sh` --opts test/mocha.opts
node_modules/.bin/nyc node_modules/mocha/bin/_mocha --opts test/mocha.opts `scripts/_get-test-directories.sh`
node_modules/.bin/nyc report --reporter=json