Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
fix: use aegir echo server and remove webpack resolve alias
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias committed Apr 28, 2020
1 parent 0dd8a13 commit bea51ad
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 40 deletions.
29 changes: 13 additions & 16 deletions packages/ipfs/.aegir.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

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 EchoServer = require('aegir/utils/echo-server')
const webRTCStarSigServer = require('libp2p-webrtc-star/src/sig-server')
const path = require('path')
const webpack = require('webpack')

let preloadNode
let echoServer
let echoServer = new EchoServer()

// the second signalling server is needed for the inferface test 'should list peers only once even if they have multiple addresses'
let sigServerA
Expand All @@ -17,17 +16,6 @@ let ipfsdServer

module.exports = {
bundlesize: { maxSize: '601kB' },
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/**/*',
Expand All @@ -41,10 +29,14 @@ module.exports = {
node: {
pre: async () => {
preloadNode = MockPreloadNode.createNode()
echoServer = EchoServer.createServer()

await preloadNode.start(),
await echoServer.start()
return {
env: {
ECHO_SERVER: `http://${echoServer.host}:${echoServer.port}`
}
}
},
post: async () => {
await preloadNode.stop(),
Expand All @@ -54,7 +46,6 @@ module.exports = {
browser: {
pre: async () => {
preloadNode = MockPreloadNode.createNode()
echoServer = EchoServer.createServer()

await preloadNode.start()
await echoServer.start()
Expand Down Expand Up @@ -90,6 +81,12 @@ module.exports = {
ipfsBin: require('go-ipfs-dep').path()
}
}).start()

return {
env: {
ECHO_SERVER: `http://${echoServer.host}:${echoServer.port}`
}
}
},
post: async () => {
await ipfsdServer.stop()
Expand Down
45 changes: 21 additions & 24 deletions packages/ipfs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
"./test/utils/create-repo-nodejs.js": "./test/utils/create-repo-browser.js",
"ipfs-utils/src/files/glob-source": false
},
"browser-all-ipld-formats": {
"./src/core/runtime/ipld-browser.js": "./src/core/runtime/ipld-browser-all.js"
},
"bin": {
"jsipfs": "src/cli/bin.js"
},
Expand All @@ -39,21 +36,21 @@
"scripts": {
"lint": "aegir lint",
"build": "aegir build",
"test": "cross-env ECHO_SERVER_PORT=37480 aegir test",
"test:node": "cross-env ECHO_SERVER_PORT=37481 aegir test -t node",
"test:browser": "cross-env ECHO_SERVER_PORT=37482 aegir test -t browser",
"test:browser:http": "cross-env ECHO_SERVER_PORT=37489 aegir test -t browser -f test/http-api/index.js",
"test:webworker": "cross-env ECHO_SERVER_PORT=37483 aegir test -t webworker",
"test:electron": "cross-env ECHO_SERVER_PORT=37484 aegir test -t electron-main -t electron-renderer",
"test:electron-main": "cross-env ECHO_SERVER_PORT=37485 aegir test -t electron-main",
"test:electron-renderer": "cross-env ECHO_SERVER_PORT=37486 aegir test -t electron-renderer",
"test:cli": "cross-env ECHO_SERVER_PORT=37487 aegir test -t node -f test/cli/index.js",
"test:node:core": "cross-env ECHO_SERVER_PORT=37488 aegir test -t node -f test/core/**/*.js",
"test:node:http": "cross-env ECHO_SERVER_PORT=37489 aegir test -t node -f test/http-api/index.js",
"test:node:gateway": "cross-env ECHO_SERVER_PORT=37490 aegir test -t node -f test/gateway/index.js",
"test:interface": "cross-env ECHO_SERVER_PORT=37491 aegir test -f test/core/interface.spec.js",
"test:interface:http": "cross-env ECHO_SERVER_PORT=37489 aegir test -f test/http-api/interface.js",
"test:bootstrapers": "cross-env ECHO_SERVER_PORT=37492 IPFS_TEST=bootstrapers aegir test -t browser -f test/bootstrapers.js",
"test": "aegir test",
"test:node": "aegir test -t node",
"test:browser": "aegir test -t browser",
"test:browser:http": "aegir test -t browser -f test/http-api/index.js",
"test:webworker": "aegir test -t webworker",
"test:electron": "aegir test -t electron-main -t electron-renderer",
"test:electron-main": "aegir test -t electron-main",
"test:electron-renderer": "aegir test -t electron-renderer",
"test:cli": "aegir test -t node -f test/cli/index.js",
"test:node:core": "aegir test -t node -f test/core/**/*.js",
"test:node:http": "aegir test -t node -f test/http-api/index.js",
"test:node:gateway": "aegir test -t node -f test/gateway/index.js",
"test:interface": "aegir test -f test/core/interface.spec.js",
"test:interface:http": "aegir test -f test/http-api/interface.js",
"test:bootstrapers": "IPFS_TEST=bootstrapers aegir test -t browser -f test/bootstrapers.js",
"test:interop": "cross-env IPFS_JS_EXEC=$PWD/src/cli/bin.js IPFS_JS_MODULE=$PWD IPFS_REUSEPORT=false ipfs-interop",
"test:interop:node": "cross-env IPFS_JS_EXEC=$PWD/src/cli/bin.js IPFS_JS_MODULE=$PWD IPFS_REUSEPORT=false ipfs-interop -- -t node",
"test:interop:browser": "cross-env IPFS_JS_EXEC=$PWD/src/cli/bin.js IPFS_JS_MODULE=$PWD IPFS_REUSEPORT=false ipfs-interop -- -t browser",
Expand Down Expand Up @@ -84,7 +81,7 @@
"class-is": "^1.1.0",
"dag-cbor-links": "^1.3.3",
"datastore-core": "^1.0.0",
"datastore-level": "ipfs/js-datastore-level#chore/update-deps",
"datastore-level": "^1.0.0",
"datastore-pubsub": "^0.3.1",
"debug": "^4.1.0",
"dlv": "^1.1.3",
Expand All @@ -96,7 +93,7 @@
"hapi-pino": "^6.1.0",
"hashlru": "^2.3.0",
"interface-datastore": "^0.8.3",
"ipfs-bitswap": "ipfs/js-ipfs-bitswap#fix/really-remove-node-globals",
"ipfs-bitswap": "^0.29.1",
"ipfs-block-service": "^0.16.0",
"ipfs-core-utils": "^0.2.0",
"ipfs-http-client": "^44.0.1",
Expand All @@ -106,7 +103,7 @@
"ipfs-unixfs-exporter": "^2.0.1",
"ipfs-unixfs-importer": "^2.0.1",
"ipfs-utils": "^2.2.0",
"ipld": "^0.26.1",
"ipld": "^0.26.2",
"ipld-bitcoin": "^0.3.0",
"ipld-block": "^0.9.1",
"ipld-dag-cbor": "^0.15.2",
Expand Down Expand Up @@ -139,14 +136,14 @@
"libp2p-delegated-peer-routing": "^0.4.2",
"libp2p-floodsub": "^0.20.0",
"libp2p-gossipsub": "^0.3.0",
"libp2p-kad-dht": "^0.18.6",
"libp2p-kad-dht": "^0.18.7",
"libp2p-keychain": "^0.6.0",
"libp2p-mdns": "^0.13.1",
"libp2p-mplex": "^0.9.3",
"libp2p-record": "libp2p/js-libp2p-record#fix/remove-buffer",
"libp2p-record": "^0.7.3",
"libp2p-secio": "^0.12.2",
"libp2p-tcp": "^0.14.3",
"libp2p-webrtc-star": "^0.17.9",
"libp2p-webrtc-star": "^0.17.10",
"libp2p-websockets": "^0.13.3",
"mafmt": "^7.0.0",
"merge-options": "^2.0.0",
Expand Down

0 comments on commit bea51ad

Please sign in to comment.