Load common gulp tasks and configs so you don't need to redefine them for every module
Supplies a common interface to the following gulp modules:
- gulp-mocha
- gulp-jshint
- gulp-istanbul
- gulp-istanbul-enforcer
- gulp-plato
- gulp-help
- gulp-nice-package
- gulp-shrinkwrap
gulp help
for available tasks. Right now these are the default tasks:
You can debug your mocha tests using a tool like node-inspector
combined with the gulp test-debug
target
// gulpfile.js
var gulp = require('load-common-gulp-tasks')(require('gulp'));
load-common-gulp-tasks
tries to assume smart defaults but also attempts to be very configurable.
Each option can be overridden by passing an options
object as the second parameter,
e.g. require('load-common-gulp-tasks')(gulp, options);
Type: Object
Default:
{
includeUntested: true
}
See here for all available options
Type: Object
Default:
{
dir: './target/coverage'
}
See here for all available options
Type: Object
Default:
{
thresholds: {
statements: 80,
branches: 70,
lines: 80,
functions: 80
},
coverageDirectory: './target/coverage',
rootDirectory: ''
}
See here for all available options
Type: Object
Default:
{
lint: [
'./*.js',
'./lib/**/*.js',
'./test/**/*.js'
],
felint: [
'./content/**/*.js'
],
cover: [
'./lib/**/*.js'
],
test: [
'./test/**/*.js'
]
}
Glob paths used by the associated targets
Type: String
Default: node_modules/load-common-gulp-tasks/lint/.jshintrc
.jshintrc
file to use when running gulp lint
target
Type: String
Default: node_modules/load-common-gulp-tasks/felint/.jshintrc
.jshintrc
file to use when running gulp felint
target
Type: String
Default: ./target/complexity
Report destination.
Type: Object
Default: {}
Options passed to complexity-report.
Type: Boolean
Default: false
Optionally show the gulp stream size of each task
Type: String
Default: npm
spec option for package.json-validator
Type: Object
Default:
{
warnings: false,
recommendations: false
}
spec option for package.json-validator
Type: Object
Default:
{
timeout: 2000,
reporter: 'dot'
}
These options are passed to gulp-mocha in testing tasks.
If a timeout
option is given, it will also be used as a default value
for options.mochaWatch
, used in 'watching' test tasks.
See here for all available options
Type: Object
Default:
{
timeout: 2000, // overriden by options.mocha.timeout if present
reporter: 'min',
growl: true
}
If a timeout
option is not given here, but in options.mocha, it will be used here. These options are passed to gulp-mocha when used in 'watching' tests.
See here for all available options Note: some options, like growl
, remain undocumented.
To override default tasks or create new ones, simply define them after calling require('load-common-gulp-tasks')(gulp);
in your gulpfile.js
, e.g.
var gulp = require('gulp'),
sass = require('gulp-sass'),
sassFiles = './lib/*/sass/*.scss',
options;
// ------------------------
// custom coverage settings
// ------------------------
options = {
istanbulEnforcer: {
thresholds: {
statements: 83, // higher than default
branches: 59, // lower than default
// lines not defined. use default
functions: 58
}
}
};
// ------------------------
// load common tasks
// ------------------------
require('load-common-gulp-tasks')(gulp, options);
// ------------------------
// custom tasks
// ------------------------
gulp.task('watch', 'Watch sass files and recompile on change', function () {
gulp.watch(sassFiles, ['styles']);
});
gulp.task('styles', 'Compile sass to css', function () {
return gulp.src(sassFiles)
.pipe(sass())
.pipe(gulp.dest('./public'));
});
Since Node 0.11.13, ES6 functionality is available to applications with the harmony flag. In order to enable ES6 support just add --harmony with your task
gulp ci --harmony
All tasks with the exception of "test-cover" work using --harmony flag. In order to use test-cover, either override the specific task or as an alternative you can use the #harmony branch, which points to a similar branch for gulp-istanbul.