diff --git a/test/bitswap.spec.js b/test/bitswap.spec.js index b878cf67c..2f7844289 100644 --- a/test/bitswap.spec.js +++ b/test/bitswap.spec.js @@ -27,7 +27,10 @@ describe('.bitswap', function () { }) }) - after((done) => ipfsd.stop(done)) + after((done) => { + if (!ipfsd) return done() + ipfsd.stop(done) + }) it('.wantlist', (done) => { ipfs.bitswap.wantlist((err, res) => { diff --git a/test/commands.spec.js b/test/commands.spec.js index 02d73427b..2e82f6d8d 100644 --- a/test/commands.spec.js +++ b/test/commands.spec.js @@ -25,7 +25,10 @@ describe('.commands', function () { }) }) - after((done) => ipfsd.stop(done)) + after((done) => { + if (!ipfsd) return done() + ipfsd.stop(done) + }) it('lists commands', (done) => { ipfs.commands((err, res) => { diff --git a/test/constructor.spec.js b/test/constructor.spec.js index fb8b6ca23..56b0e7c57 100644 --- a/test/constructor.spec.js +++ b/test/constructor.spec.js @@ -35,7 +35,10 @@ describe('ipfs-api constructor tests', () => { }) }) - after((done) => ipfsd.stop(done)) + after((done) => { + if (!ipfsd) return done() + ipfsd.stop(done) + }) it('opts', (done) => { const splitted = apiAddr.split('/') diff --git a/test/diag.spec.js b/test/diag.spec.js index 3a2bb07a5..d2648024d 100644 --- a/test/diag.spec.js +++ b/test/diag.spec.js @@ -28,7 +28,10 @@ describe('.diag', function () { }) }) - after((done) => ipfsd.stop(done)) + after((done) => { + if (!ipfsd) return done() + ipfsd.stop(done) + }) describe('Callback API', () => { // Disabled in go-ipfs 0.4.10 diff --git a/test/files.spec.js b/test/files.spec.js index e3832b3b6..d3021db3c 100644 --- a/test/files.spec.js +++ b/test/files.spec.js @@ -47,7 +47,10 @@ describe('.files (the MFS API part)', function () { }) }) - after((done) => ipfsd.stop(done)) + after((done) => { + if (!ipfsd) return done() + ipfsd.stop(done) + }) it('add file for testing', (done) => { ipfs.files.add(testfile, (err, res) => { diff --git a/test/get.spec.js b/test/get.spec.js index af28ba61c..a8a2adbf5 100644 --- a/test/get.spec.js +++ b/test/get.spec.js @@ -41,7 +41,10 @@ describe('.get (specific go-ipfs features)', function () { ], done) }) - after((done) => ipfsd.stop(done)) + after((done) => { + if (!ipfsd) return done() + ipfsd.stop(done) + }) it('no compression args', (done) => { ipfs.get(smallFile.cid, (err, files) => { diff --git a/test/key.spec.js b/test/key.spec.js index 24a2a77b1..7de7a2a97 100644 --- a/test/key.spec.js +++ b/test/key.spec.js @@ -25,7 +25,10 @@ describe('.key', function () { }) }) - after((done) => ipfsd.stop(done)) + after((done) => { + if (!ipfsd) return done() + ipfsd.stop(done) + }) describe('Callback API', () => { describe('.gen', () => { diff --git a/test/log.spec.js b/test/log.spec.js index b45911c2f..1c583b670 100644 --- a/test/log.spec.js +++ b/test/log.spec.js @@ -25,7 +25,10 @@ describe('.log', function () { }) }) - after((done) => ipfsd.stop(done)) + after((done) => { + if (!ipfsd) return done() + ipfsd.stop(done) + }) it('.log.tail', (done) => { const req = ipfs.log.tail((err, res) => { diff --git a/test/name.spec.js b/test/name.spec.js index baad2654d..93b371af9 100644 --- a/test/name.spec.js +++ b/test/name.spec.js @@ -62,8 +62,14 @@ describe('.name', () => { after((done) => { parallel([ - (cb) => ipfsd.stop(cb), - (cb) => otherd.stop(cb) + (cb) => { + if (!ipfsd) return cb() + ipfsd.stop(cb) + }, + (cb) => { + if (!otherd) return cb() + otherd.stop(cb) + } ], done) }) diff --git a/test/ping.spec.js b/test/ping.spec.js index c429a95ee..49e96a8b0 100644 --- a/test/ping.spec.js +++ b/test/ping.spec.js @@ -60,8 +60,14 @@ describe('.ping', function () { after((done) => { parallel([ - (cb) => ipfsd.stop(cb), - (cb) => otherd.stop(cb) + (cb) => { + if (!ipfsd) return cb() + ipfsd.stop(cb) + }, + (cb) => { + if (!otherd) return cb() + otherd.stop(cb) + } ], done) }) diff --git a/test/pubsub-in-browser.spec.js b/test/pubsub-in-browser.spec.js index 274839805..6a47044f9 100644 --- a/test/pubsub-in-browser.spec.js +++ b/test/pubsub-in-browser.spec.js @@ -55,7 +55,10 @@ describe('.pubsub is not supported in the browser, yet!', function () { }) }) - after((done) => ipfsd.stop(done)) + after((done) => { + if (!ipfsd) return done() + ipfsd.stop(done) + }) describe('everything errors', () => { describe('Callback API', () => { diff --git a/test/refs.spec.js b/test/refs.spec.js index e8d36b541..7ce245455 100644 --- a/test/refs.spec.js +++ b/test/refs.spec.js @@ -49,7 +49,10 @@ describe('.refs', function () { ], done) }) - after((done) => ipfsd.stop(done)) + after((done) => { + if (!ipfsd) return done() + ipfsd.stop(done) + }) const result = [ { diff --git a/test/repo.spec.js b/test/repo.spec.js index f08c50ca1..8bdf95bd7 100644 --- a/test/repo.spec.js +++ b/test/repo.spec.js @@ -24,7 +24,10 @@ describe('.repo', function () { }) }) - after((done) => ipfsd.stop(done)) + after((done) => { + if (!ipfsd) return done() + ipfsd.stop(done) + }) it('.repo.gc', (done) => { ipfs.repo.gc((err, res) => { diff --git a/test/stats.spec.js b/test/stats.spec.js index 81abb945a..c7eb48c13 100644 --- a/test/stats.spec.js +++ b/test/stats.spec.js @@ -24,7 +24,10 @@ describe('stats', function () { }) }) - after((done) => ipfsd.stop(done)) + after((done) => { + if (!ipfsd) return done() + ipfsd.stop(done) + }) it('.stats.bitswap', (done) => { ipfs.stats.bitswap((err, res) => { diff --git a/test/types.spec.js b/test/types.spec.js index 5310982ae..49b68a5ef 100644 --- a/test/types.spec.js +++ b/test/types.spec.js @@ -34,7 +34,10 @@ describe('.types', function () { }) }) - after((done) => ipfsd.stop(done)) + after((done) => { + if (!ipfsd) return done() + ipfsd.stop(done) + }) it('types object', () => { expect(ipfs.types).to.be.deep.equal({ diff --git a/test/util.spec.js b/test/util.spec.js index e8372d501..f18612f7b 100644 --- a/test/util.spec.js +++ b/test/util.spec.js @@ -32,7 +32,10 @@ describe('.util', () => { }) }) - after((done) => ipfsd.stop(done)) + after((done) => { + if (!ipfsd) return done() + ipfsd.stop(done) + }) it('.streamAdd', (done) => { const tfpath = path.join(__dirname, '/fixtures/testfile.txt')