Skip to content

Commit

Permalink
Move coverage to gulp
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Aug 22, 2015
1 parent b0a4902 commit 106cfa2
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 5 deletions.
37 changes: 37 additions & 0 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,43 @@ gulp.task('integration', ['build:lib', 'build:package'], (done) => {
});
});

// Coverage

gulp.task('coverage:instrument', () => {
require('./');
let istanbul = require('gulp-istanbul');
let isparta = require('isparta')
return gulp.src('lib/*.es6')
.pipe(istanbul({
includeUntested: true,
instrumenter: isparta.Instrumenter
}))
.pipe(istanbul.hookRequire({
extensions: ['.es6']
}));
});

gulp.task('coverage:report', () => {
let istanbul = require('gulp-istanbul');
return gulp.src('lib/*.es6', { read: false })
.pipe(istanbul.writeReports())
.pipe(istanbul.enforceThresholds({
thresholds: {
global: {
statements: 89.12,
functions: 87.29,
branches: 81.85,
lines: 91
}
}
}));
});

gulp.task('coverage', (done) => {
let runSequence = require('run-sequence');
runSequence('coverage:instrument', 'test', 'coverage:report', done);
});

// Common

gulp.task('default', ['lint', 'spellcheck', 'test', 'integration']);
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
require('babel-core/register')({ extensions: ['.es6'], ignore: false });
require('babel-core/register')({ extensions: ['.es6'] });
module.exports = require('./lib/postcss');
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,17 @@
"concat-with-sourcemaps": "1.0.2",
"postcss-parser-tests": "5.0.0",
"gulp-json-editor": "2.2.1",
"gulp-istanbul": "0.10.0",
"run-sequence": "1.1.2",
"babel-eslint": "4.0.10",
"gulp-eslint": "1.0.0",
"gulp-mocha": "2.1.3",
"gulp-babel": "5.2.1",
"strip-ansi": "3.0.0",
"yaspeller": "2.5.0",
"gulp-util": "3.0.6",
"gulp-run": "1.6.10",
"fs-extra": "0.23.1",
"istanbul": "0.3.18",
"isparta": "3.0.3",
"eslint": "1.2.1",
"sinon": "1.16.1",
Expand All @@ -47,8 +49,6 @@
"del": "1.2.1"
},
"scripts": {
"check-coverage": "istanbul check-coverage --statements 89.12 --branches 81.85 --functions 87.29 --lines 91.71",
"cover": "isparta cover node_modules/mocha/bin/_mocha -i lib/*.es6",
"test": "gulp && npm run cover && npm run check-coverage"
"test": "gulp"
}
}

0 comments on commit 106cfa2

Please sign in to comment.