-
Notifications
You must be signed in to change notification settings - Fork 7
/
.aegir.js
57 lines (54 loc) · 1.61 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
import { createServer } from 'ipfsd-ctl'
import EchoServer from 'aegir/echo-server'
/**
* @typedef {object} BeforeType
* @property {import('ipfsd-ctl').Controller} server
* @property {EchoServer} echoServer
* @property {typeof import('./test/utils/mock-pinning-service.js')} pinningService
* @property {Record<string, string>} env
*/
/** @type {import('aegir').PartialOptions} */
export default {
build: {
bundlesizeMax: '42KB'
},
test: {
/**
* @param {Parameters<import('aegir').Options['test']['before']>[0]} options
* @returns {Promise<BeforeType>}
*/
async before (options) {
const { PinningService } = await import('./dist/test/utils/mock-pinning-service.js')
const pinningService = await PinningService.start()
const server = createServer({
port: 0
}, {
type: 'kubo',
rpc: (await import('./dist/src/index.js')).create,
bin: (await import('kubo')).default.path()
})
const echoServer = new EchoServer()
await echoServer.start()
await server.start()
/**
* @type {BeforeType}
*/
return {
server,
echoServer,
pinningService,
env: {
IPFSD_SERVER: `http://${server.host}:${server.server.info.port}`,
PINNING_SERVICE_ENDPOINT: pinningService.endpoint,
PINNING_SERVICE_KEY: 'secret',
ECHO_SERVER: `http://${echoServer.host}:${echoServer.port}`,
}
}
},
async after (options, before) {
await before.echoServer.stop()
await before.server.stop()
await before.pinningService.stop()
}
}
}