forked from borodean/postcss-assets
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGulpfile.js
More file actions
48 lines (41 loc) · 1.16 KB
/
Gulpfile.js
File metadata and controls
48 lines (41 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
var gulp = require('gulp');
var javascripts = {
gulpfile: 'Gulpfile.js',
source: ['index.js', 'lib/**/*.js'],
tests: 'test/**/*.js'
};
javascripts.all = Object.keys(javascripts).reduce(function (result, key) {
return result.concat(javascripts[key]);
}, []);
gulp.task('jscs', function () {
var jscs = require('gulp-jscs');
return gulp.src(javascripts.all)
.pipe(jscs({
preset: 'yandex',
disallowMultipleVarDecl: 'exceptUndefined'
}));
});
gulp.task('lint', function () {
var jshint = require('gulp-jshint');
return gulp.src(javascripts.all)
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'));
});
gulp.task('test', function (cb) {
var istanbul = require('gulp-istanbul');
var mocha = require('gulp-mocha');
gulp.src(javascripts.source)
.pipe(istanbul())
.pipe(istanbul.hookRequire())
.on('finish', function () {
gulp.src(javascripts.tests)
.pipe(mocha())
.pipe(istanbul.writeReports())
.on('end', cb);
});
});
gulp.task('watch', function () {
return gulp.watch(javascripts.all, ['default']);
});
gulp.task('default', ['lint', 'jscs', 'test']);