forked from dollarshaveclub/postmate
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gulpfile.js
45 lines (40 loc) · 1.03 KB
/
Gulpfile.js
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
const connect = require('connect')
const gulp = require('gulp')
const http = require('http')
const mochaPhantomJS = require('gulp-mocha-phantomjs')
const path = require('path')
const serveStatic = require('serve-static')
let parentServer
let childServer
gulp.task('parent-test-server', (done) => {
parentServer = http
.createServer(
connect()
.use(serveStatic('.'))
.use(serveStatic('test/acceptance/fixtures'))
)
.listen(9000, done)
})
gulp.task('child-test-server', (done) => {
childServer = http
.createServer(
connect()
.use(serveStatic('.'))
.use(serveStatic('test/acceptance/fixtures'))
)
.listen(9001, done)
})
gulp.task('do-test', () => {
const stream = mochaPhantomJS({
phantomjs: {
useColors: true
}
})
stream.write({ path: 'http://localhost:9001/test/acceptance/runner.html' })
stream.end()
return stream
})
gulp.task('test', ['parent-test-server', 'child-test-server', 'do-test'], () => {
parentServer.close()
childServer.close()
})