-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.coffee
34 lines (28 loc) · 1.01 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
# Load all required libraries.
gulp = require 'gulp'
gutil = require 'gulp-util'
coffee = require 'gulp-coffee'
istanbul = require 'gulp-istanbul'
mocha = require 'gulp-mocha'
plumber = require 'gulp-plumber'
gulp.on 'err', (e) ->
gutil.beep()
gutil.log e.err.stack
gulp.task 'coffee', ->
gulp.src './src/**/*.coffee'
.pipe plumber() # Pevent pipe breaking caused by errors from gulp plugins
.pipe coffee({bare: true})
.pipe gulp.dest './lib/'
gulp.task 'test', ['coffee'], ->
gulp.src ['lib/**/*.js']
.pipe(istanbul()) # Covering files
.pipe(istanbul.hookRequire()) # Overwrite require so it returns the covered files
.on 'finish', ->
gulp.src(['test/**/*.spec.coffee'])
.pipe mocha reporter: 'spec', compilers: 'coffee:coffee-script'
.pipe istanbul.writeReports() # Creating the reports after tests run
gulp.task 'watch', ->
gulp.watch './src/**/*.coffee', ['coffee']
gulp.task 'testwatch', ->
gulp.watch './src/**/*.coffee', ['test']
gulp.task 'default', ['coffee']