forked from ipfs/js-ipfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.aegir.js
103 lines (97 loc) · 2.72 KB
/
.aegir.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
'use strict'
const { createServer } = require('ipfsd-ctl')
const MockPreloadNode = require('./test/utils/mock-preload-node')
const EchoServer = require('interface-ipfs-core/src/utils/echo-http-server')
const webRTCStarSigServer = require('libp2p-webrtc-star/src/sig-server')
const path = require('path')
const webpack = require('webpack')
let preloadNode
let echoServer
// the second signalling server is needed for the inferface test 'should list peers only once even if they have multiple addresses'
let sigServerA
let sigServerB
let ipfsdServer
module.exports = {
bundlesize: { maxSize: '652kB' },
webpack: {
resolve: {
mainFields: ['browser', 'main'],
aliasFields: ['browser', 'browser-all-ipld-formats'],
},
...(process.env.NODE_ENV === 'test' ? {
plugins: [
new webpack.EnvironmentPlugin(['DEBUG', 'ECHO_SERVER_PORT'])
]
} : {})
},
karma: {
files: [{
pattern: 'node_modules/interface-ipfs-core/test/fixtures/**/*',
watched: false,
served: true,
included: false
}],
browserNoActivityTimeout: 100 * 1000,
},
hooks: {
node: {
pre: async () => {
preloadNode = MockPreloadNode.createNode()
echoServer = EchoServer.createServer()
await preloadNode.start(),
await echoServer.start()
},
post: async () => {
await preloadNode.stop(),
await echoServer.stop()
}
},
browser: {
pre: async () => {
preloadNode = MockPreloadNode.createNode()
echoServer = EchoServer.createServer()
await preloadNode.start()
await echoServer.start()
sigServerA = await webRTCStarSigServer.start({
host: '127.0.0.1',
port: 14579,
metrics: false
})
sigServerB = await webRTCStarSigServer.start({
host: '127.0.0.1',
port: 14578,
metrics: false
})
ipfsdServer = await createServer({
host: '127.0.0.1',
port: 57483
}, {
type: 'js',
ipfsModule: require(__dirname),
ipfsHttpModule: require('ipfs-http-client'),
ipfsBin: path.join(__dirname, 'src', 'cli', 'bin.js'),
ipfsOptions: {
config: {
libp2p: {
dialer: {
dialTimeout: 60e3 // increase timeout because travis is slow
}
}
}
}
}, {
go: {
ipfsBin: require('go-ipfs-dep').path()
}
}).start()
},
post: async () => {
await ipfsdServer.stop()
await preloadNode.stop()
await echoServer.stop()
await sigServerA.stop()
await sigServerB.stop()
}
}
}
}