forked from ipfs/js-ipfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
41 lines (33 loc) · 949 Bytes
/
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
'use strict'
const gulp = require('gulp')
const parallel = require('run-parallel')
const series = require('run-series')
const createTempNode = require('./test/utils/temp-node')
const API = require('./src/http-api')
let nodes = []
function startNode (num, done) {
createTempNode(num, (err, node) => {
if (err) throw err
const api = new API(node.repo.path())
nodes.push(api)
api.start(done)
})
}
gulp.task('libnode:start', (done) => {
nodes = []
parallel([
(cb) => startNode(7, cb),
(cb) => startNode(8, cb),
(cb) => startNode(9, cb)
], done)
})
gulp.task('libnode:stop', (done) => {
series(nodes.map((node) => (cb) => {
setTimeout(() => node.stop(cb), 500)
}), done)
})
gulp.task('test:browser:before', ['libnode:start'])
gulp.task('test:node:before', ['libnode:start'])
gulp.task('test:browser:after', ['libnode:stop'])
gulp.task('test:node:after', ['libnode:stop'])
require('aegir/gulp')(gulp)