Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
refactor: make ipfs and http client peer dependencies (#90)
Browse files Browse the repository at this point in the history
By depending on a certain version of ipfs and the ipfs http client
it means we can't run all the tests on other versions of ipfs/the
http client as the `require`s resolve to the wrong version.

This PR makes them peer dependencies to allow the tester/testing
environment to specify which versions of modules we want to test.
  • Loading branch information
achingbrain authored and Alan Shaw committed Nov 19, 2019
1 parent 5c9c60f commit 73f2440
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 17 deletions.
14 changes: 10 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ os:
- linux
- osx

script: npx nyc -s npm run test:node -- --bail
script:
- npm install ipfs go-ipfs-dep
- npx nyc -s npm run test:node -- --bail
after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov

jobs:
Expand All @@ -36,13 +38,17 @@ jobs:
name: chrome
addons:
chrome: stable
script: npx aegir test -t browser
script:
- npm install ipfs go-ipfs-dep
- npx aegir test -t browser

- stage: test
name: firefox
addons:
firefox: latest
script: npx aegir test -t browser -- --browsers FirefoxHeadless
script:
- npm install ipfs go-ipfs-dep
- npx aegir test -t browser -- --browsers FirefoxHeadless

notifications:
email: false
email: false
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ This repository will be used for interop tests. Please jump into the issues if y
> git clone [email protected]:ipfs/interop.git
> cd interop
> npm install
# install a version of js-ipfs to test with
> npm install ipfs
# optionally install a version of js-ipfs-http-client to test with
# (otherwise the one ipfs depends on will be used)
> npm install ipfs-http-client
# install a version of go-ipfs to test with
> npm install go-ipfs-dep
```

### Run the tests
Expand All @@ -29,15 +39,8 @@ This repository will be used for interop tests. Please jump into the issues if y
### Test with a non yet released version of js-ipfs

```
# Do the steps in the install section, then
> cd ..
> git clone [email protected]:ipfs/js-ipfs.git
> cd js-ipfs
> npm install
> npm link
> cd ../interop
> npm link ipfs
> npm test
# Do the steps in the install section but skip installing ipfs, then
> IPFS_JS_EXEC=/path/to/js-ipfs/src/cli/bin.js IPFS_JS_MODULE=/path/to/js-ipfs npm test
```

### Test with a non yet released version of go-ipfs
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@
"delay": "^4.3.0",
"detect-node": "^2.0.4",
"dirty-chai": "^2.0.1",
"go-ipfs-dep": "~0.4.22",
"hat": "~0.0.3",
"ipfs": "^0.39.0",
"ipfs-http-client": "^39.0.2",
"ipfs-unixfs": "~0.1.16",
"ipfsd-ctl": "~0.47.4",
"ipns": "^0.6.1",
Expand All @@ -71,5 +68,10 @@
"contributors": [],
"devDependencies": {
"karma-mocha-webworker": "^1.3.0"
},
"peerDependencies": {
"go-ipfs-dep": "~0.4.22",
"ipfs": "^0.39.0",
"ipfs-http-client": "^39.0.2"
}
}
8 changes: 7 additions & 1 deletion test/utils/circuit.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ const { spawnGoDaemon, spawnJsDaemon } = require('./daemon')

const crypto = require('crypto')

const IPFS = require('ipfs')
let IPFS

if (process.env.IPFS_JS_MODULE) {
IPFS = require(process.env.IPFS_JS_MODULE)
} else {
IPFS = require('ipfs')
}

const DaemonFactory = require('ipfsd-ctl')
const procDf = DaemonFactory.create({ type: 'proc', exec: IPFS })
Expand Down

0 comments on commit 73f2440

Please sign in to comment.