-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.testing.coffee
40 lines (32 loc) · 1.24 KB
/
build.testing.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
# https://github.com/pgte/nock#readme
gulp = require 'gulp'
mocha = require 'gulp-mocha'
util = require 'gulp-util'
# Expose assertion libs globally such that tests do not need to require()
global.expect = require('must')
# This task will run all tests (*.spec.(coffee|es6))
runAllSpecs = ->
gulp.src ['./src/**/*.spec.coffee' ]
.pipe mocha reporter:'spec'
.on 'error', util.log
runAllSpecs.description = "Run all tests"
gulp.task 'test:all', runAllSpecs
# This task will run all tests (*.spec.(coffee|es6))
runIntegrationSpecs = ->
gulp.src ['./src/**/*.int.spec.coffee']
.pipe mocha reporter:'spec'
.on 'error', util.log
runIntegrationSpecs.description = "Run integration tests only"
gulp.task 'test:integration', runIntegrationSpecs
# This task will run all tests (*.spec.(coffee|es6))
runUnitSpecs = ->
gulp.src ['./src/**/*.spec.coffee','./src/**/*int.spec.coffee' ]
.pipe mocha reporter:'spec'
.on 'error', util.log
runUnitSpecs.description = "Run unit tests only"
gulp.task 'test:unit', runUnitSpecs
# This task will execute tests and watch src folder for changes
watchTests = ->
gulp.watch ['./src/**/*'], gulp.series 'test:all'
gulp.task 'test:watch', watchTests
gulp.task 'test:auto', gulp.series 'test:all', 'test:watch'