diff --git a/README.md b/README.md index 38e66ae5a87abc71c2e4e8711f4f06b42aa98f6d..23841cd61466599140311785d2feb3e2f76ca24c 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,9 @@ Previous versions of Node.js do not support ECMAScript6, it is recommended to us > nvm use v4.5.0 -4) Install babel and gulp globally +4) Install the global dependencies -> npm install --global gulp gulp-cli babel babel-cli babel-core babel-register mocha gulp-mocha gulp-eslint +> npm install --global gulp gulp-cli babel babel-cli babel-core babel-register mocha gulp-mocha gulp-eslint istanbul 5) Install project dependencies diff --git a/gulpfile.babel.js b/gulpfile.babel.js index 10fd314abbdc370592336e4bf0222270c33536dc..0ad22595aeee07c654a1afa0f9d09647d8d071de 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -8,6 +8,8 @@ const eslint = require('gulp-eslint'); const mocha = require('gulp-mocha'); +const istanbul = require('gulp-istanbul'); + const nodemon = require('gulp-nodemon'); const Cache = require('gulp-file-cache'); @@ -61,10 +63,18 @@ gulp.task('docco', () => { gulp.task('doc', ['docco']); -gulp.task('test', () => { +gulp.task('pre-test', () => { + return gulp.src(['build/**/*.js', '!build/{test,test/**}']) + .pipe(istanbul()) + .pipe(istanbul.hookRequire()); +}); + +gulp.task('test', ['pre-test'], () => { process.chdir('build'); gulp.src('test/test.js', {read: false}) .pipe(mocha()) + .pipe(istanbul.writeReports()) + .pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } })) .once('error', () => { process.exit(1); }) diff --git a/package.json b/package.json index ed17027d11134108f1acaa338f236a05fa40478b..d477028f1cc2935964241cde6376b3fd33c40cfc 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "gulp-eslint": "^3.0.1", "gulp-file-cache": "0.0.1", "gulp-function": "^1.3.6", + "gulp-istanbul": "^1.1.1", "gulp-jsdoc3": "^0.3.0", "gulp-mocha": "^3.0.1", "gulp-nodemon": "^2.1.0",