-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.coffee
43 lines (36 loc) · 1.14 KB
/
gulpfile.coffee
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
del = require 'del'
gulp = require 'gulp'
gutil = require 'gulp-util'
coffee = require 'gulp-coffee'
sourcemaps = require 'gulp-sourcemaps'
istanbul = require 'gulp-coffee-istanbul'
coffeelint = require 'gulp-coffeelint'
mocha = require 'gulp-mocha'
jsFiles = ['lib/*.js']
specFiles = ['spec/**/*.coffee']
coffeeFiles = ['src/**/*.coffee']
testFiles = jsFiles
buildFiles = ['lib', 'coverage']
gulp.task 'clean', ->
del.sync buildFiles
gulp.task 'lint', ->
gulp.src coffeeFiles
.pipe coffeelint()
.pipe coffeelint.reporter()
.pipe coffeelint.reporter('fail') # fail task
gulp.task 'coffee', ['lint'], ->
gulp.src coffeeFiles
.pipe sourcemaps.init()
.pipe coffee({bare: true}).on('error', gutil.log)
.pipe sourcemaps.write()
.pipe gulp.dest './lib/'
gulp.task 'build', ['coffee']
gulp.task 'test', ['coffee'], ->
gulp.src testFiles
.pipe istanbul( includeUntested: true ) # Covering files
.pipe istanbul.hookRequire()
.on 'finish', ->
gulp.src specFiles
.pipe mocha reporter: 'nyan'
.pipe istanbul.writeReports() # Creating the reports after tests run
gulp.task 'default', ['test']