Skip to content

Commit 663e4ce

Browse files
authored
fix: remove node globals (#2932)
1 parent fd082e8 commit 663e4ce

File tree

13 files changed

+18268
-53
lines changed

13 files changed

+18268
-53
lines changed

.aegir.js

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
'use strict'
22

3-
const createServer = require('ipfsd-ctl').createServer
4-
const EchoServer = require('interface-ipfs-core/src/utils/echo-http-server')
3+
const { createServer } = require('ipfsd-ctl')
4+
const EchoServer = require('aegir/utils/echo-server')
5+
6+
57
const server = createServer({
68
host: '127.0.0.1',
79
port: 48372
@@ -10,21 +12,11 @@ const server = createServer({
1012
ipfsHttpModule: require('./'),
1113
ipfsBin: require('go-ipfs-dep').path()
1214
})
13-
let echoServer
14-
const webpack = require('webpack')
15+
16+
let echoServer = new EchoServer()
1517

1618
module.exports = {
1719
bundlesize: { maxSize: '89kB' },
18-
webpack: {
19-
resolve: {
20-
mainFields: ['browser', 'main']
21-
},
22-
...(process.env.NODE_ENV === 'test' ? {
23-
plugins: [
24-
new webpack.EnvironmentPlugin(['DEBUG', 'ECHO_SERVER_PORT'])
25-
]
26-
} : {})
27-
},
2820
karma: {
2921
files: [{
3022
pattern: 'node_modules/interface-ipfs-core/test/fixtures/**/*',
@@ -37,21 +29,28 @@ module.exports = {
3729
},
3830
hooks: {
3931
node: {
40-
pre: () => {
41-
echoServer = EchoServer.createServer()
42-
43-
return echoServer.start()
32+
pre: async () => {
33+
await echoServer.start()
34+
return {
35+
env: {
36+
ECHO_SERVER: `http://${echoServer.host}:${echoServer.port}`
37+
}
38+
}
4439
},
4540
post: () => echoServer.stop()
4641
},
4742
browser: {
48-
pre: () => {
49-
echoServer = EchoServer.createServer()
43+
pre: async () => {
5044

51-
return Promise.all([
45+
await Promise.all([
5246
server.start(),
5347
echoServer.start()
5448
])
49+
return {
50+
env: {
51+
ECHO_SERVER: `http://${echoServer.host}:${echoServer.port}`
52+
}
53+
}
5554
},
5655
post: () => {
5756
return Promise.all([

0 commit comments

Comments
 (0)