Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
fix: don't error to specific
Browse files Browse the repository at this point in the history
When stopping an IPFS node it returns an error. The error message
depends on the environment. In Browsers it might also return
`Failed to fetch` or `XHR error`. Hence removing the specific
error check as it would fail for Browsers.

Instead check if the node is an go-ipfs one.
  • Loading branch information
vmx authored and daviddias committed Mar 13, 2018
1 parent fcb8341 commit ec16016
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions js/src/miscellaneous.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ chai.use(dirtyChai)
module.exports = (common) => {
describe('.miscellaneous', () => {
let ipfs
let withGo

before(function (done) {
// CI takes longer to instantiate the daemon, so we need to increase the
Expand All @@ -22,7 +23,11 @@ module.exports = (common) => {
factory.spawnNode((err, node) => {
expect(err).to.not.exist()
ipfs = node
done()
ipfs.id((err, id) => {
expect(err).to.not.exist()
withGo = id.agentVersion.startsWith('go-ipfs')
done()
})
})
})
})
Expand Down Expand Up @@ -83,12 +88,15 @@ module.exports = (common) => {
})

// must be last test to run
it('.stop', (done) => {
// TODO: go-ipfs returns an error, https://github.com/ipfs/go-ipfs/issues/4078
it('.stop', function (done) {
this.timeout(10 * 1000)
ipfs.stop((err) => {
if (err && err.message !== 'read ECONNRESET') {
// TODO: go-ipfs returns an error, https://github.com/ipfs/go-ipfs/issues/4078
if (!withGo) {
expect(err).to.not.exist()
}
// Trying to stop an already stopped node should return an error
// as the node can't respond to requests anymore
ipfs.stop((err) => {
expect(err).to.exist()
done()
Expand Down

0 comments on commit ec16016

Please sign in to comment.