-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGulpfile.coffee
62 lines (55 loc) · 1.5 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
gulp = require 'gulp'
mocha = require 'gulp-mocha'
karma = require 'karma'
webpackStream = require 'webpack-stream'
coffeelint = require 'gulp-coffeelint'
paths =
coffee: ['./src/**/*.coffee', './*.coffee', './test/**/*.coffee']
tests: './test/**/*.coffee'
rootScripts: './src/index.coffee'
rootServerTests: './test/zorium_server.coffee'
build: './build'
output:
tests: 'tests.js'
gulp.task 'test', ['test:lint', 'test:server', 'test:browser']
gulp.task 'watch', ->
gulp.watch paths.coffee, ['test:browser', 'test:server']
gulp.task 'test:lint', ->
gulp.src paths.coffee
.pipe coffeelint()
.pipe coffeelint.reporter()
gulp.task 'test:server', ->
gulp.src paths.rootServerTests
.pipe mocha
compilers: 'coffee:coffee-script/register'
timeout: 400
useColors: true
gulp.task 'test:browser', ['scripts:test'], (cb) ->
new karma.Server({
singleRun: true
frameworks: ['mocha']
client:
useIframe: true
captureConsole: true
mocha:
timeout: 300
files: [
"#{paths.build}/#{paths.output.tests}"
]
browsers: ['ChromeHeadless']
}, cb).start()
gulp.task 'scripts:test', ->
gulp.src paths.tests
.pipe webpackStream
devtool: '#inline-source-map'
output:
filename: paths.output.tests
module:
exprContextRegExp: /$^/
exprContextCritical: false
loaders: [
{test: /\.coffee$/, loader: 'coffee-loader'}
]
resolve:
extensions: ['.coffee', '.js']
.pipe gulp.dest paths.build