-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
55 lines (45 loc) · 1.21 KB
/
gulpfile.js
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
49
50
51
52
53
54
55
'use strict';
var gulp = require('gulp'),
paths = {
gulp: 'gulpfile.js',
src: 'index.js',
test: 'test/**/*.{e2e,spec}.js'
};
gulp.task('default', ['test']);
gulp.task('lint', function () {
var jscs = require('gulp-jscs'),
jshint = require('gulp-jshint');
return gulp
.src([paths.gulp, paths.src, paths.test])
.pipe(jscs())
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.on('error', console.error.bind(console));
});
gulp.task('copy', function () {
// Trabea is its own fixture.
return gulp
.src(paths.src)
.pipe(gulp.dest('test/fixtures'))
.on('error', console.error.bind(console));
});
gulp.task('cover', function () {
var istanbul = require('gulp-istanbul');
return gulp
.src(paths.src)
.pipe(istanbul())
.pipe(istanbul.hookRequire())
.on('error', console.error.bind(console));
});
gulp.task('test', ['lint', 'copy', 'cover'], function () {
var istanbul = require('gulp-istanbul'),
mocha = require('gulp-mocha');
return gulp
.src(paths.test)
.pipe(mocha({ reporter: 'spec' }))
.pipe(istanbul.writeReports())
.on('error', console.error.bind(console));
});
gulp.task('watch', function () {
gulp.watch(['./index.js', './test/*.js', './theme/**'], ['test']);
});