1 | var execSync = require('child_process').execSync,
|
2 | eslint = require('gulp-eslint'),
|
3 | gulp = require('gulp'),
|
4 | mocha = require('gulp-mocha'),
|
5 | path = require('path'),
|
6 | spawn = require('child_process').spawn
|
7 |
|
8 | gulp.task('lint', function () {
|
9 |
|
10 | return gulp.src([
|
11 | 'src/**/*.js',
|
12 | 'test/**/*.js'
|
13 | ])
|
14 | .pipe(eslint())
|
15 | .pipe(eslint.format())
|
16 | .pipe(eslint.failOnError())
|
17 |
|
18 | })
|
19 |
|
20 | gulp.task('mocha', function(done) {
|
21 |
|
22 | gulp
|
23 | .src([
|
24 | './test/setup.js',
|
25 | './test/unit/**.js',
|
26 | ], {read: false})
|
27 | .pipe(mocha({reporter: 'spec'}))
|
28 | .on('end', function () {
|
29 |
|
30 | process.exit()
|
31 |
|
32 | })
|
33 | .on('error', function (e) {
|
34 | console.error(e)
|
35 | })
|
36 |
|
37 | })
|
38 |
|
39 | gulp.task('test', ['mocha'])
|
40 |
|
41 | gulp.task('t', ['test'])
|