-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
39 lines (33 loc) · 1.16 KB
/
gulpfile.js
File metadata and controls
39 lines (33 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
'use strict';
var gulp = require( 'gulp' );
var gutil = require( 'gulp-util' );
var istanbul = require( 'gulp-istanbul' );
var mocha = require( 'gulp-mocha' );
var jshint = require( 'gulp-jshint' );
var JS_SRC = [ 'index.js', 'lib/**/*.js', 'relays/**/*.js' ];
var TEST_SRC = [ 'test/**/*.js' ];
// Run unit tets. Pass `--cover` if you'd also like a coverage report.
gulp.task( 'test', function ( cb ) {
// If `--cover` is not set, just run tests
if ( !gutil.env.cover ) {
return gulp.src( TEST_SRC )
.pipe( mocha() );
}
gulp.src( JS_SRC )
.pipe( istanbul( { includeUntested: true } ) )
.on( 'finish', function () {
gulp.src( TEST_SRC )
.pipe( mocha() )
.pipe( istanbul.writeReports( {
reporters: [ 'text', 'text-summary' ]
} ) )
.on( 'finish', cb );
} );
} );
// Run JS hint
gulp.task( 'jshint', function () {
return gulp.src( JS_SRC.concat( TEST_SRC, __filename ) )
.pipe( jshint() )
.pipe( jshint.reporter( 'default' ) )
.pipe( jshint.reporter( 'fail' ) );
} );