From 9b03f2f2ab7e37162e2d9b3093943f750f7b6180 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Tue, 10 Sep 2019 08:56:05 +0100 Subject: [PATCH 01/18] chore: run interop tests as part of the build Also tag last successful build and ensure we do not get stealth multiaddr@v7 --- .aegir.js | 2 +- .travis.yml | 21 +++++++++++++++++++-- package.json | 6 ++++-- src/core/components/libp2p.js | 6 +++++- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/.aegir.js b/.aegir.js index caa757d76f..da26b81e79 100644 --- a/.aegir.js +++ b/.aegir.js @@ -10,7 +10,7 @@ const preloadNode = MockPreloadNode.createNode() const echoServer = EchoServer.createServer() module.exports = { - bundlesize: { maxSize: '692kB' }, + bundlesize: { maxSize: '696kB' }, webpack: { resolve: { mainFields: ['browser', 'main'], diff --git a/.travis.yml b/.travis.yml index f7eef6a3ce..628c151b0e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ cache: false stages: - check - test - - cov + - tag node_js: - '10' @@ -18,8 +18,14 @@ os: - osx - windows +env: + # This stops Windows builds from hanging + # https://travis-ci.community/t/timeout-after-build-finished-and-succeeded/1336 + - YARN_GPG=no + script: npx nyc -s npx aegir test -t node --timeout 10000 --bail -after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov +after_success: + - npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov jobs: include: @@ -55,5 +61,16 @@ jobs: script: - xvfb-run npx aegir test -t electron-renderer -- --bail --timeout 10000 + - stage: test + name: interop + script: + - npm run test:interop + + - stage: tag + if: branch = master AND type = push AND fork = false + name: update-last-successful-build + script: + - npx aegir update-last-successful-build + notifications: email: false diff --git a/package.json b/package.json index b406d695a5..8f57690b77 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "test:node:cli": "aegir test -t node -f test/cli/index.js", "test:node:interface": "aegir test -t node -f test/core/interface.spec.js", "test:bootstrapers": "IPFS_TEST=bootstrapers aegir test -t browser -f test/bootstrapers.js", + "test:interop": "IPFS_JS_EXEC=$PWD/src/cli/bin.js ipfs-interop", "coverage": "nyc --reporter=text --reporter=lcov npm run test:node", "benchmark": "echo \"Error: no benchmarks yet\" && exit 1", "benchmark:node": "echo \"Error: no benchmarks yet\" && exit 1", @@ -141,7 +142,7 @@ "libp2p-websocket-star-multi": "~0.4.3", "libp2p-websockets": "~0.12.3", "lodash": "^4.17.15", - "mafmt": "^6.0.2", + "mafmt": "^6.0.10", "merge-options": "^1.0.1", "mime-types": "^2.1.21", "mkdirp": "~0.5.1", @@ -186,7 +187,7 @@ "yargs-promise": "^1.1.0" }, "devDependencies": { - "aegir": "^20.0.0", + "aegir": "^20.1.0", "base64url": "^3.0.1", "chai": "^4.2.0", "clear-module": "^4.0.0", @@ -198,6 +199,7 @@ "form-data": "^2.5.1", "hat": "0.0.3", "interface-ipfs-core": "^0.113.0", + "ipfs-interop": "~0.1.0", "ipfsd-ctl": "~0.46.0", "libp2p-websocket-star": "~0.10.2", "ncp": "^2.0.0", diff --git a/src/core/components/libp2p.js b/src/core/components/libp2p.js index b39a035565..35ddce54dc 100644 --- a/src/core/components/libp2p.js +++ b/src/core/components/libp2p.js @@ -61,7 +61,11 @@ function defaultBundle ({ datastore, peerInfo, peerBook, options, config }) { } const getPubsubRouter = () => { - const router = get(config, 'Pubsub.Router', 'gossipsub') + let router = get(config, 'Pubsub.Router', 'gossipsub') + + if (!router) { + router = 'gossipsub' + } if (!PubsubRouters[router]) { throw errCode(new Error(`Router unavailable. Configure libp2p.modules.pubsub to use the ${router} router.`), 'ERR_NOT_SUPPORTED') From 67d7d8cadad098fbe70031435113b91229af87be Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Thu, 5 Sep 2019 11:09:12 +0100 Subject: [PATCH 02/18] feat: allow daemon to init and start in a single cmd This PR aligns `ipfs init` and `ipfs daemon` with go-ipfs. https://github.com/ipfs/go-ipfs/pull/6489 `ipfs init` changed to accept a file path as an argument `ipfs daemon` changed to support `--init` and `--init-config` options. Now we can do `ipfs daemon --init --init-config /path/to/custom-config` refs: https://github.com/ipfs/js-ipfsd-ctl/pull/303 --- package.json | 3 ++- src/cli/commands/daemon.js | 25 +++++++++++++++++++ src/cli/commands/init.js | 22 +++++++++++++---- src/cli/daemon.js | 2 +- test/cli/daemon.js | 49 ++++++++++++++++++++++++++++++++++++++ test/cli/init.js | 20 +++++++++------- 6 files changed, 106 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 8f57690b77..9b7ff3fe1e 100644 --- a/package.json +++ b/package.json @@ -207,7 +207,8 @@ "qs": "^6.5.2", "rimraf": "^3.0.0", "sinon": "^7.4.2", - "stream-to-promise": "^2.2.0" + "stream-to-promise": "^2.2.0", + "temp-write": "^4.0.0" }, "optionalDependencies": { "prom-client": "^11.5.3", diff --git a/src/cli/commands/daemon.js b/src/cli/commands/daemon.js index a0b4aa0c8b..1345a50215 100644 --- a/src/cli/commands/daemon.js +++ b/src/cli/commands/daemon.js @@ -1,9 +1,11 @@ 'use strict' const os = require('os') +const fs = require('fs') const toUri = require('multiaddr-to-uri') const { ipfsPathHelp } = require('../utils') const { isTest } = require('ipfs-utils/src/env') +const debug = require('debug')('ipfs:cli:daemon') module.exports = { command: 'daemon', @@ -13,6 +15,15 @@ module.exports = { builder (yargs) { return yargs .epilog(ipfsPathHelp) + .option('init', { + type: 'boolean', + default: false, + desc: 'Initialize ipfs with default settings if not already initialized.' + }) + .option('init-config', { + type: 'string', + desc: 'Path to existing configuration file to be loaded during --init.' + }) .option('enable-sharding-experiment', { type: 'boolean', default: false @@ -42,9 +53,23 @@ module.exports = { const repoPath = argv.getRepoPath() + let config = {} + // read and parse config file + if (argv.initConfig) { + try { + const raw = fs.readFileSync(argv.initConfig) + config = JSON.parse(raw) + } catch (error) { + debug(error) + throw new Error('Default config couldn\'t be found or content isn\'t valid JSON.') + } + } + // Required inline to reduce startup time const Daemon = require('../../cli/daemon') const daemon = new Daemon({ + init: argv.init, + config, silent: argv.silent, repo: process.env.IPFS_PATH, offline: argv.offline, diff --git a/src/cli/commands/init.js b/src/cli/commands/init.js index 78095d25e4..74e62ac344 100644 --- a/src/cli/commands/init.js +++ b/src/cli/commands/init.js @@ -1,15 +1,17 @@ 'use strict' +const fs = require('fs') +const debug = require('debug')('ipfs:cli:init') const { ipfsPathHelp } = require('../utils') module.exports = { - command: 'init [config] [options]', + command: 'init [default-config] [options]', describe: 'Initialize a local IPFS node', builder (yargs) { return yargs .epilog(ipfsPathHelp) - .positional('config', { - describe: 'Node config, this should JSON and will be merged with the default config. Check https://github.com/ipfs/js-ipfs#optionsconfig', + .positional('default-config', { + describe: 'Initialize with the given configuration. Path to the config file. Check https://github.com/ipfs/js-ipfs#optionsconfig', type: 'string' }) .option('bits', { @@ -34,6 +36,18 @@ module.exports = { argv.resolve((async () => { const path = argv.getRepoPath() + let config = {} + // read and parse config file + if (argv.defaultConfig) { + try { + const raw = fs.readFileSync(argv.defaultConfig) + config = JSON.parse(raw) + } catch (error) { + debug(error) + throw new Error('Default config couldn\'t be found or content isn\'t valid JSON.') + } + } + argv.print(`initializing ipfs node at ${path}`) // Required inline to reduce startup time @@ -44,7 +58,7 @@ module.exports = { repo: new Repo(path), init: false, start: false, - config: argv.config || {} + config }) try { diff --git a/src/cli/daemon.js b/src/cli/daemon.js index 7181e8c1e7..10a757e482 100644 --- a/src/cli/daemon.js +++ b/src/cli/daemon.js @@ -55,7 +55,7 @@ class Daemon { } // start the daemon - const ipfsOpts = Object.assign({ init: false }, this._options, { start: true, libp2p }) + const ipfsOpts = Object.assign({ }, this._options, { start: true, libp2p }) const ipfs = new IPFS(ipfsOpts) await new Promise((resolve, reject) => { diff --git a/test/cli/daemon.js b/test/cli/daemon.js index eb05d981aa..840aedeecb 100644 --- a/test/cli/daemon.js +++ b/test/cli/daemon.js @@ -9,10 +9,29 @@ const os = require('os') const path = require('path') const hat = require('hat') const fs = require('fs') +const tempWrite = require('temp-write') const pkg = require('../../package.json') const skipOnWindows = isWindows() ? it.skip : it +const daemonReady = (daemon, fn) => { + let r = null + const p = new Promise((resolve, reject) => { + daemon.stdout.on('data', async (data) => { + if (data.toString().includes('Daemon is ready')) { + try { + r = await fn() + } catch (err) { + reject(err) + } + daemon.kill() + } + }) + daemon.stderr.on('data', () => reject(new Error('Daemon didnt start'))) + daemon.then(() => resolve(r)).catch(reject) + }) + return p +} const checkLock = (repo) => { // skip on windows // https://github.com/ipfs/js-ipfsd-ctl/pull/155#issuecomment-326983530 @@ -265,4 +284,34 @@ describe('daemon', () => { expect(err.stdout).to.include(`Node.js version: ${process.versions.node}`) } }) + + it('should init', async function () { + this.timeout(100 * 1000) + const daemon = ipfs('daemon --init') + let stdout = '' + + daemon.stdout.on('data', (data) => { + stdout += data.toString('utf8') + + if (stdout.includes('Daemon is ready')) { + daemon.kill() + } + }) + + try { + await daemon + throw new Error('Did not kill process') + } catch (err) { + expect(err.killed).to.be.true() + } + }) + + it('should init with custom config', async function () { + this.timeout(100 * 1000) + const configPath = tempWrite.sync('{"Addresses": {"API": "/ip4/127.0.0.1/tcp/9999"}}', 'config.json') + const daemon = ipfs(`daemon --init --init-config ${configPath}`) + + const r = await daemonReady(daemon, () => ipfs('config \'Addresses.API\'')) + expect(r).to.be.eq('/ip4/127.0.0.1/tcp/9999') + }) }) diff --git a/test/cli/init.js b/test/cli/init.js index ab9082a731..e317c6b145 100644 --- a/test/cli/init.js +++ b/test/cli/init.js @@ -8,9 +8,10 @@ const clean = require('../utils/clean') const hat = require('hat') const ipfsExec = require('../utils/ipfs-exec') const os = require('os') +const tempWrite = require('temp-write') describe('init', function () { - this.timeout(40 * 1000) + this.timeout(100 * 1000) let repoPath let ipfs @@ -33,8 +34,6 @@ describe('init', function () { afterEach(() => clean(repoPath)) it('basic', function () { - this.timeout(40 * 1000) - return ipfs('init').then((out) => { expect(repoDirSync('blocks')).to.have.length.above(2) expect(repoExistsSync('config')).to.equal(true) @@ -48,8 +47,6 @@ describe('init', function () { }) it('bits', function () { - this.timeout(40 * 1000) - return ipfs('init --bits 1024').then(() => { expect(repoDirSync('blocks')).to.have.length.above(2) expect(repoExistsSync('config')).to.equal(true) @@ -58,8 +55,6 @@ describe('init', function () { }) it('empty', function () { - this.timeout(40 * 1000) - return ipfs('init --bits 1024 --empty-repo true').then(() => { expect(repoDirSync('blocks')).to.have.length(2) expect(repoExistsSync('config')).to.equal(true) @@ -68,11 +63,18 @@ describe('init', function () { }) it('should present ipfs path help when option help is received', function (done) { - this.timeout(100 * 1000) - ipfs('init --help').then((res) => { expect(res).to.have.string('export IPFS_PATH=/path/to/ipfsrepo') done() }) }) + + it('default config argument', () => { + const configPath = tempWrite.sync('{"Addresses": {"API": "/ip4/127.0.0.1/tcp/9999"}}', 'config.json') + return ipfs(`init ${configPath}`).then((res) => { + const configRaw = fs.readFileSync(path.join(repoPath, 'config')).toString() + const config = JSON.parse(configRaw) + expect(config.Addresses.API).to.be.eq('/ip4/127.0.0.1/tcp/99999') + }) + }) }) From 4627c627423245f78125c480d6cbffd33caa61f9 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Thu, 5 Sep 2019 11:55:52 +0100 Subject: [PATCH 03/18] fix: fix the expected result --- test/cli/daemon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cli/daemon.js b/test/cli/daemon.js index 840aedeecb..60efe4208c 100644 --- a/test/cli/daemon.js +++ b/test/cli/daemon.js @@ -312,6 +312,6 @@ describe('daemon', () => { const daemon = ipfs(`daemon --init --init-config ${configPath}`) const r = await daemonReady(daemon, () => ipfs('config \'Addresses.API\'')) - expect(r).to.be.eq('/ip4/127.0.0.1/tcp/9999') + expect(r).to.be.eq('/ip4/127.0.0.1/tcp/9999\n') }) }) From 026dea5f2ef6f377496c2ddc39e0283367163aee Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Thu, 5 Sep 2019 12:28:27 +0100 Subject: [PATCH 04/18] fix: fix the expected result --- test/cli/init.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cli/init.js b/test/cli/init.js index e317c6b145..e82c78b3f6 100644 --- a/test/cli/init.js +++ b/test/cli/init.js @@ -74,7 +74,7 @@ describe('init', function () { return ipfs(`init ${configPath}`).then((res) => { const configRaw = fs.readFileSync(path.join(repoPath, 'config')).toString() const config = JSON.parse(configRaw) - expect(config.Addresses.API).to.be.eq('/ip4/127.0.0.1/tcp/99999') + expect(config.Addresses.API).to.be.eq('/ip4/127.0.0.1/tcp/9999') }) }) }) From bad8bce2bc75477dcedf9e72b727e2a8d57bbb1e Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Thu, 5 Sep 2019 14:21:29 +0100 Subject: [PATCH 05/18] chore: test windows --- test/cli/daemon.js | 2 +- test/utils/ipfs-exec.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/test/cli/daemon.js b/test/cli/daemon.js index 60efe4208c..2239138563 100644 --- a/test/cli/daemon.js +++ b/test/cli/daemon.js @@ -23,7 +23,7 @@ const daemonReady = (daemon, fn) => { } catch (err) { reject(err) } - daemon.kill() + daemon.cancel() } }) daemon.stderr.on('data', () => reject(new Error('Daemon didnt start'))) diff --git a/test/utils/ipfs-exec.js b/test/utils/ipfs-exec.js index 98253fb6a6..94630a18e4 100644 --- a/test/utils/ipfs-exec.js +++ b/test/utils/ipfs-exec.js @@ -45,6 +45,7 @@ module.exports = (repoPath, opts) => { return res.stdout }) + res.cancel = cp.cancel.bind(cp) res.kill = cp.kill.bind(cp) res.stdin = cp.stdin res.stdout = cp.stdout From edcdcca473ad51e33c0861eb8331a9bd5bc16e4c Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Thu, 5 Sep 2019 15:08:56 +0100 Subject: [PATCH 06/18] fix: fix tests on windows --- test/cli/daemon.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/cli/daemon.js b/test/cli/daemon.js index 2239138563..7928a05dc5 100644 --- a/test/cli/daemon.js +++ b/test/cli/daemon.js @@ -27,7 +27,13 @@ const daemonReady = (daemon, fn) => { } }) daemon.stderr.on('data', () => reject(new Error('Daemon didnt start'))) - daemon.then(() => resolve(r)).catch(reject) + daemon.then(() => resolve(r)).catch(err => { + if (r && err.killed) { + return resolve(r) + } + + reject(err) + }) }) return p From 2266446a466084ed02d47e59a568c198cc6e88c5 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Mon, 9 Sep 2019 14:39:24 +0100 Subject: [PATCH 07/18] fix: auto init and remove --init flag --- src/cli/commands/daemon.js | 6 ------ src/cli/daemon.js | 2 +- test/cli/daemon.js | 14 +++----------- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/cli/commands/daemon.js b/src/cli/commands/daemon.js index 1345a50215..a9fdc3de45 100644 --- a/src/cli/commands/daemon.js +++ b/src/cli/commands/daemon.js @@ -15,11 +15,6 @@ module.exports = { builder (yargs) { return yargs .epilog(ipfsPathHelp) - .option('init', { - type: 'boolean', - default: false, - desc: 'Initialize ipfs with default settings if not already initialized.' - }) .option('init-config', { type: 'string', desc: 'Path to existing configuration file to be loaded during --init.' @@ -68,7 +63,6 @@ module.exports = { // Required inline to reduce startup time const Daemon = require('../../cli/daemon') const daemon = new Daemon({ - init: argv.init, config, silent: argv.silent, repo: process.env.IPFS_PATH, diff --git a/src/cli/daemon.js b/src/cli/daemon.js index 10a757e482..2528a06bc9 100644 --- a/src/cli/daemon.js +++ b/src/cli/daemon.js @@ -55,7 +55,7 @@ class Daemon { } // start the daemon - const ipfsOpts = Object.assign({ }, this._options, { start: true, libp2p }) + const ipfsOpts = Object.assign({ }, this._options, { init: true, start: true, libp2p }) const ipfs = new IPFS(ipfsOpts) await new Promise((resolve, reject) => { diff --git a/test/cli/daemon.js b/test/cli/daemon.js index 7928a05dc5..99f8fb6b2e 100644 --- a/test/cli/daemon.js +++ b/test/cli/daemon.js @@ -215,14 +215,6 @@ describe('daemon', () => { checkLock(repoPath) }) - it('gives error if user hasn\'t run init before', async function () { - this.timeout(100 * 1000) - - const err = await ipfs.fail('daemon') - - expect(err.stdout).to.include('no initialized ipfs repo found in ' + repoPath) - }) - it('should be silent', async function () { this.timeout(100 * 1000) await ipfs('init') @@ -291,9 +283,9 @@ describe('daemon', () => { } }) - it('should init', async function () { + it('should init by default if not already', async function () { this.timeout(100 * 1000) - const daemon = ipfs('daemon --init') + const daemon = ipfs('daemon') let stdout = '' daemon.stdout.on('data', (data) => { @@ -315,7 +307,7 @@ describe('daemon', () => { it('should init with custom config', async function () { this.timeout(100 * 1000) const configPath = tempWrite.sync('{"Addresses": {"API": "/ip4/127.0.0.1/tcp/9999"}}', 'config.json') - const daemon = ipfs(`daemon --init --init-config ${configPath}`) + const daemon = ipfs(`daemon --init-config ${configPath}`) const r = await daemonReady(daemon, () => ipfs('config \'Addresses.API\'')) expect(r).to.be.eq('/ip4/127.0.0.1/tcp/9999\n') From 1bdff33f925e1eb61fe851c9418e2438d0889deb Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Tue, 10 Sep 2019 15:09:09 +0100 Subject: [PATCH 08/18] chore: rename param --- test/cli/daemon.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cli/daemon.js b/test/cli/daemon.js index 99f8fb6b2e..20481dcc1a 100644 --- a/test/cli/daemon.js +++ b/test/cli/daemon.js @@ -13,13 +13,13 @@ const tempWrite = require('temp-write') const pkg = require('../../package.json') const skipOnWindows = isWindows() ? it.skip : it -const daemonReady = (daemon, fn) => { +const daemonReady = (daemon, cb) => { let r = null const p = new Promise((resolve, reject) => { daemon.stdout.on('data', async (data) => { if (data.toString().includes('Daemon is ready')) { try { - r = await fn() + r = await cb() } catch (err) { reject(err) } From 8cc564bf336eaf88dfc85340b4c4c2c1930cc4cc Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Mon, 16 Sep 2019 12:46:48 +0100 Subject: [PATCH 09/18] feat: add support for async/await setup --- test/core/interface.spec.js | 46 +------------------- test/http-api/interface.js | 46 +------------------- test/utils/interface-common-factory.js | 58 +++++++++++++++++++++++++- 3 files changed, 59 insertions(+), 91 deletions(-) diff --git a/test/core/interface.spec.js b/test/core/interface.spec.js index 10e5c225bd..84a386e353 100644 --- a/test/core/interface.spec.js +++ b/test/core/interface.spec.js @@ -4,7 +4,6 @@ const tests = require('interface-ipfs-core') const CommonFactory = require('../utils/interface-common-factory') const isNode = require('detect-node') -const callbackify = require('callbackify') describe('interface-ipfs-core tests', function () { this.timeout(20 * 1000) @@ -150,48 +149,5 @@ describe('interface-ipfs-core tests', function () { tests.stats(defaultCommonFactory) - tests.swarm(CommonFactory.create({ - createSetup ({ ipfsFactory, nodes }) { - const callbackifiedSpawn = callbackify.variadic( - ipfsFactory.spawn.bind(ipfsFactory)) - return callback => { - callback(null, { - spawnNode (repoPath, config, cb) { - if (typeof repoPath === 'function') { - cb = repoPath - repoPath = undefined - } - - if (typeof config === 'function') { - cb = config - config = null - } - - config = config || { - Bootstrap: [], - Discovery: { - MDNS: { - Enabled: false - }, - webRTCStar: { - Enabled: false - } - } - } - - const spawnOptions = { repoPath, config, initOptions: { bits: 512 } } - - callbackifiedSpawn(spawnOptions, (err, _ipfsd) => { - if (err) { - return cb(err) - } - - nodes.push(_ipfsd) - cb(null, _ipfsd.api) - }) - } - }) - } - } - }), { skip: !isNode }) + tests.swarm(CommonFactory.createAsync(), { skip: !isNode }) }) diff --git a/test/http-api/interface.js b/test/http-api/interface.js index 8c4811822c..3373f36069 100644 --- a/test/http-api/interface.js +++ b/test/http-api/interface.js @@ -4,7 +4,6 @@ const tests = require('interface-ipfs-core') const CommonFactory = require('../utils/interface-common-factory') const path = require('path') -const callbackify = require('callbackify') describe('interface-ipfs-core over ipfs-http-client tests', () => { const defaultCommonFactory = CommonFactory.create({ @@ -144,48 +143,5 @@ describe('interface-ipfs-core over ipfs-http-client tests', () => { tests.stats(defaultCommonFactory) - tests.swarm(CommonFactory.create({ - createSetup ({ ipfsFactory, nodes }) { - const callbackifiedSpawn = callbackify.variadic( - ipfsFactory.spawn.bind(ipfsFactory)) - return callback => { - callback(null, { - spawnNode (repoPath, config, cb) { - if (typeof repoPath === 'function') { - cb = repoPath - repoPath = undefined - } - - if (typeof config === 'function') { - cb = config - config = undefined - } - - config = config || { - Bootstrap: [], - Discovery: { - MDNS: { - Enabled: false - }, - webRTCStar: { - Enabled: false - } - } - } - - const spawnOptions = { repoPath, config, initOptions: { bits: 512 } } - - callbackifiedSpawn(spawnOptions, (err, _ipfsd) => { - if (err) { - return cb(err) - } - - nodes.push(_ipfsd) - cb(null, _ipfsd.api) - }) - } - }) - } - } - })) + tests.swarm(CommonFactory.createAsync()) }) diff --git a/test/utils/interface-common-factory.js b/test/utils/interface-common-factory.js index b6f0e72245..0b2d55fe75 100644 --- a/test/utils/interface-common-factory.js +++ b/test/utils/interface-common-factory.js @@ -69,4 +69,60 @@ function createFactory (options) { } } -exports.create = createFactory +function createAsync (createFactoryOptions = {}, createSpawnOptions = {}) { + return () => { + const nodes = [] + const setup = async (factoryOptions = {}, spawnOptions = {}) => { + factoryOptions = mergeOptions( + { + type: 'proc', + exec: IPFS + }, + factoryOptions, + createFactoryOptions + ) + // When not an in proc daemon use the http-client js-ipfs depends on, not the one from ipfsd-ctl + if (factoryOptions.type !== 'proc') { + factoryOptions.IpfsClient = factoryOptions.IpfsClient || ipfsClient + } + + const ipfsFactory = IPFSFactory.create(factoryOptions) + const node = await ipfsFactory.spawn(mergeOptions( + { + config: { + Bootstrap: [], + Discovery: { + MDNS: { + Enabled: false + }, + webRTCStar: { + Enabled: false + } + } + }, + preload: { enabled: false } + }, + spawnOptions, + createSpawnOptions + )) + nodes.push(node) + + const id = await node.api.id() + node.api.peerId = id + + return node.api + } + + const teardown = () => { + return Promise.all(nodes.map(n => n.stop())) + } + return { + setup, + teardown + } + } +} +module.exports = { + createAsync, + create: createFactory +} From 4d2076330b7889873fb49e06a643cb0e30b6079c Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Mon, 16 Sep 2019 12:47:06 +0100 Subject: [PATCH 10/18] fix: fix electron setup --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 628c151b0e..6d6a0f7d1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,26 +40,26 @@ jobs: addons: chrome: stable script: - - npx aegir test -t browser - - npx aegir test -t webworker + - npx aegir test -t browser -t webworker - stage: test name: firefox addons: firefox: latest script: - - npx aegir test -t browser -- --browsers FirefoxHeadless - - npx aegir test -t webworker -- --browsers FirefoxHeadless + - npx aegir test -t browser -t webworker -- --browsers FirefoxHeadless - stage: test name: electron-main + os: osx script: - - xvfb-run npx aegir test -t electron-main -- --bail --timeout 10000 + - npx aegir test -t electron-main -- --bail --timeout 10000 - stage: test name: electron-renderer + os: osx script: - - xvfb-run npx aegir test -t electron-renderer -- --bail --timeout 10000 + - npx aegir test -t electron-renderer -- --bail --timeout 10000 - stage: test name: interop From 9e83e3f1ac799bcf0d13c1db03d9e65f5fbca2d8 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Mon, 16 Sep 2019 12:47:31 +0100 Subject: [PATCH 11/18] fix: upgrade deps to match --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 9b7ff3fe1e..372e64e0c6 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "ipfs-bitswap": "~0.25.1", "ipfs-block": "~0.8.1", "ipfs-block-service": "~0.15.2", - "ipfs-http-client": "^35.1.0", + "ipfs-http-client": "ipfs/js-ipfs-http-client#fix/fix-electron", "ipfs-http-response": "~0.3.1", "ipfs-mfs": "^0.12.2", "ipfs-multipart": "^0.2.0", @@ -123,7 +123,7 @@ "it-to-stream": "^0.1.1", "just-safe-set": "^2.1.0", "kind-of": "^6.0.2", - "ky": "~0.13.0", + "ky": "~0.14.0", "ky-universal": "~0.3.0", "libp2p": "~0.26.1", "libp2p-bootstrap": "~0.9.3", @@ -187,7 +187,7 @@ "yargs-promise": "^1.1.0" }, "devDependencies": { - "aegir": "^20.1.0", + "aegir": "^20.2.0", "base64url": "^3.0.1", "chai": "^4.2.0", "clear-module": "^4.0.0", @@ -198,9 +198,9 @@ "execa": "^2.0.4", "form-data": "^2.5.1", "hat": "0.0.3", - "interface-ipfs-core": "^0.113.0", + "interface-ipfs-core": "github:ipfs/interface-ipfs-core#fix/fix-electron", "ipfs-interop": "~0.1.0", - "ipfsd-ctl": "~0.46.0", + "ipfsd-ctl": "ipfs/js-ipfsd-ctl#chore/new-http-client", "libp2p-websocket-star": "~0.10.2", "ncp": "^2.0.0", "p-event": "^4.1.0", From d134357b048dbb999a08783e069e922323807492 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Mon, 16 Sep 2019 12:47:45 +0100 Subject: [PATCH 12/18] chore: fix linter --- src/cli/commands/daemon.js | 2 +- src/cli/commands/file/ls.js | 2 +- src/cli/commands/init.js | 2 +- src/cli/commands/version.js | 4 +- src/core/components/pin/gc.js | 2 +- src/core/components/pin/pin-manager.js | 2 +- src/core/config.js | 2 +- src/core/ipns/publisher.js | 12 ++-- src/core/ipns/republisher.js | 2 +- src/core/ipns/resolver.js | 4 +- test/cli/file.js | 4 +- test/cli/files.js | 4 +- test/cli/gc.js | 6 +- test/cli/name.js | 4 +- test/cli/swarm.js | 4 +- test/core/bitswap.spec.js | 2 +- test/core/circuit-relay.js | 2 +- test/core/pin-set.js | 2 +- test/core/pin.js | 78 +++++++++++++++++--------- test/core/utils.js | 4 +- test/gateway/index.js | 2 +- test/http-api/files.js | 22 ++++---- test/http-api/inject/bootstrap.js | 4 +- test/http-api/inject/dht.js | 10 ++-- test/http-api/inject/name.js | 2 +- test/http-api/inject/pin.js | 12 ++-- test/http-api/inject/ping.js | 6 +- test/http-api/inject/pubsub.js | 6 +- 28 files changed, 117 insertions(+), 91 deletions(-) diff --git a/src/cli/commands/daemon.js b/src/cli/commands/daemon.js index a9fdc3de45..6ca2193cf6 100644 --- a/src/cli/commands/daemon.js +++ b/src/cli/commands/daemon.js @@ -99,7 +99,7 @@ module.exports = { print('Daemon is ready') const cleanup = async () => { - print(`Received interrupt signal, shutting down...`) + print('Received interrupt signal, shutting down...') await daemon.stop() process.exit(0) } diff --git a/src/cli/commands/file/ls.js b/src/cli/commands/file/ls.js index 2469245d47..20be00c5cc 100644 --- a/src/cli/commands/file/ls.js +++ b/src/cli/commands/file/ls.js @@ -11,7 +11,7 @@ module.exports = { argv.resolve((async () => { const path = argv.key // `ipfs file ls` is deprecated. See https://ipfs.io/docs/commands/#ipfs-file-ls - argv.print(`This functionality is deprecated, and will be removed in future versions. If possible, please use 'ipfs ls' instead.`) + argv.print('This functionality is deprecated, and will be removed in future versions. If possible, please use \'ipfs ls\' instead.') const ipfs = await argv.getIpfs() let links = await ipfs.ls(path) diff --git a/src/cli/commands/init.js b/src/cli/commands/init.js index 74e62ac344..0a3c5de095 100644 --- a/src/cli/commands/init.js +++ b/src/cli/commands/init.js @@ -71,7 +71,7 @@ module.exports = { }) } catch (err) { if (err.code === 'EACCES') { - err.message = `EACCES: permission denied, stat $IPFS_PATH/version` + err.message = 'EACCES: permission denied, stat $IPFS_PATH/version' } throw err } diff --git a/src/cli/commands/version.js b/src/cli/commands/version.js index 1af4737059..63a8864a25 100644 --- a/src/cli/commands/version.js +++ b/src/cli/commands/version.js @@ -17,12 +17,12 @@ module.exports = { commit: { type: 'boolean', default: false, - describe: `Include the version's commit hash` + describe: 'Include the version\'s commit hash' }, repo: { type: 'boolean', default: false, - describe: `Print only the repo's version number` + describe: 'Print only the repo\'s version number' }, all: { type: 'boolean', diff --git a/src/core/components/pin/gc.js b/src/core/components/pin/gc.js index 9f8714abcc..5615d3ea3d 100644 --- a/src/core/components/pin/gc.js +++ b/src/core/components/pin/gc.js @@ -77,7 +77,7 @@ function createMarkedSet (ipfs, callback) { (cb) => ipfs._repo.root.get(MFS_ROOT_KEY, (err, mh) => { if (err) { if (err.code === 'ERR_NOT_FOUND') { - log(`No blocks in MFS`) + log('No blocks in MFS') return cb(null, []) } return cb(expErr(err, 'Could not get MFS root from datastore')) diff --git a/src/core/components/pin/pin-manager.js b/src/core/components/pin/pin-manager.js index 096980fcec..a55f9d28d5 100644 --- a/src/core/components/pin/pin-manager.js +++ b/src/core/components/pin/pin-manager.js @@ -274,7 +274,7 @@ class PinManager { this.repo.datastore.get(PIN_DS_KEY, (err, mh) => { if (err) { if (err.code === 'ERR_NOT_FOUND') { - this.log(`No pinned blocks`) + this.log('No pinned blocks') return callback(null, []) } return callback(new Error(`Could not get pin sets root from datastore: ${err.message}`)) diff --git a/src/core/config.js b/src/core/config.js index ba419d47a8..beb1d149f8 100644 --- a/src/core/config.js +++ b/src/core/config.js @@ -21,7 +21,7 @@ const s = superstruct({ return true }, - 'multiaddr-ipfs': v => mafmt.IPFS.matches(v) ? true : `multiaddr IPFS invalid` + 'multiaddr-ipfs': v => mafmt.IPFS.matches(v) ? true : 'multiaddr IPFS invalid' } }) diff --git a/src/core/ipns/publisher.js b/src/core/ipns/publisher.js index 67c91fa180..20d8045f28 100644 --- a/src/core/ipns/publisher.js +++ b/src/core/ipns/publisher.js @@ -48,7 +48,7 @@ class IpnsPublisher { _putRecordToRouting (record, peerId, callback) { if (!(PeerId.isPeerId(peerId))) { - const errMsg = `peerId received is not valid` + const errMsg = 'peerId received is not valid' log.error(errMsg) return callback(errcode(new Error(errMsg), 'ERR_INVALID_PEER_ID')) @@ -87,7 +87,7 @@ class IpnsPublisher { _publishEntry (key, entry, peerId, callback) { if (!(Key.isKey(key))) { - const errMsg = `datastore key does not have a valid format` + const errMsg = 'datastore key does not have a valid format' log.error(errMsg) return callback(errcode(new Error(errMsg), 'ERR_INVALID_DATASTORE_KEY')) @@ -118,14 +118,14 @@ class IpnsPublisher { _publishPublicKey (key, publicKey, peerId, callback) { if ((!Key.isKey(key))) { - const errMsg = `datastore key does not have a valid format` + const errMsg = 'datastore key does not have a valid format' log.error(errMsg) return callback(errcode(new Error(errMsg), 'ERR_INVALID_DATASTORE_KEY')) } if (!publicKey || !publicKey.bytes) { - const errMsg = `one or more of the provided parameters are not defined` + const errMsg = 'one or more of the provided parameters are not defined' log.error(errMsg) return callback(errcode(new Error(errMsg), 'ERR_UNDEFINED_PARAMETER')) @@ -149,7 +149,7 @@ class IpnsPublisher { // If `checkRouting` is true and we have no existing record, this method will check the routing system for any existing records. _getPublished (peerId, options, callback) { if (!(PeerId.isPeerId(peerId))) { - const errMsg = `peerId received is not valid` + const errMsg = 'peerId received is not valid' log.error(errMsg) return callback(errcode(new Error(errMsg), 'ERR_INVALID_PEER_ID')) @@ -209,7 +209,7 @@ class IpnsPublisher { _updateOrCreateRecord (privKey, value, validity, peerId, callback) { if (!(PeerId.isPeerId(peerId))) { - const errMsg = `peerId received is not valid` + const errMsg = 'peerId received is not valid' log.error(errMsg) return callback(errcode(new Error(errMsg), 'ERR_INVALID_PEER_ID')) diff --git a/src/core/ipns/republisher.js b/src/core/ipns/republisher.js index 9fef7b3300..b71a19cb6d 100644 --- a/src/core/ipns/republisher.js +++ b/src/core/ipns/republisher.js @@ -167,7 +167,7 @@ class IpnsRepublisher { record = ipns.unmarshal(dsVal) } catch (err) { log.error(err) - return callback(errcode(new Error(`found ipns record that we couldn't convert to a value`), 'ERR_INVALID_IPNS_RECORD')) + return callback(errcode(new Error('found ipns record that we couldn\'t convert to a value'), 'ERR_INVALID_IPNS_RECORD')) } callback(null, record.value) diff --git a/src/core/ipns/resolver.js b/src/core/ipns/resolver.js index 5d6385b198..125f228eed 100644 --- a/src/core/ipns/resolver.js +++ b/src/core/ipns/resolver.js @@ -108,7 +108,7 @@ class IpnsResolver { ipnsEntry = ipns.unmarshal(record) } catch (err) { log.error(err) - return callback(errcode(new Error(`found ipns record that we couldn't convert to a value`), 'ERR_INVALID_RECORD_RECEIVED')) + return callback(errcode(new Error('found ipns record that we couldn\'t convert to a value'), 'ERR_INVALID_RECORD_RECEIVED')) } // if the record has a public key validate it @@ -131,7 +131,7 @@ class IpnsResolver { peerId.pubKey = crypto.keys.unmarshalPublicKey(pubKey) } catch (err) { log.error(err) - return callback(errcode(new Error(`found public key record that we couldn't convert to a value`), 'ERR_INVALID_PUB_KEY_RECEIVED')) + return callback(errcode(new Error('found public key record that we couldn\'t convert to a value'), 'ERR_INVALID_PUB_KEY_RECEIVED')) } this._validateRecord(peerId, ipnsEntry, callback) diff --git a/test/cli/file.js b/test/cli/file.js index e4a5e0c9ce..261c4c0777 100644 --- a/test/cli/file.js +++ b/test/cli/file.js @@ -18,7 +18,7 @@ describe('file ls', () => runOnAndOff((thing) => { it('prints a filename', () => { return ipfs(`file ls ${file}`) .then((out) => expect(out).to.eql( - `This functionality is deprecated, and will be removed in future versions. If possible, please use 'ipfs ls' instead.\n` + + 'This functionality is deprecated, and will be removed in future versions. If possible, please use \'ipfs ls\' instead.\n' + `${file}\n` )) }) @@ -26,7 +26,7 @@ describe('file ls', () => runOnAndOff((thing) => { it('prints the filenames in a directory', () => { return ipfs(`file ls ${dir}`) .then((out) => expect(out).to.eql( - `This functionality is deprecated, and will be removed in future versions. If possible, please use 'ipfs ls' instead.\n` + + 'This functionality is deprecated, and will be removed in future versions. If possible, please use \'ipfs ls\' instead.\n' + 'QmamKEPmEH9RUsqRQsfNf5evZQDQPYL9KXg1ADeT7mkHkT\n' + 'QmPkWYfSLCEBLZu7BZt4kigGDMe3cpogMbeVf97gN2xJDN\n' + 'QmUqyZtPmsRy1U5Mo8kz2BAMmk1hfJ7yW1KAFTMB2odsFv\n' + diff --git a/test/cli/files.js b/test/cli/files.js index 5e266a9d4a..473ca81f61 100644 --- a/test/cli/files.js +++ b/test/cli/files.js @@ -246,7 +246,7 @@ describe('files', () => runOnAndOff((thing) => { it('add with cid-version=1 and raw-leaves=false < default max chunk size', function () { this.timeout(30 * 1000) - return ipfs(`add test/fixtures/less-than-default-max-chunk-size --cid-version=1 --raw-leaves=false`) + return ipfs('add test/fixtures/less-than-default-max-chunk-size --cid-version=1 --raw-leaves=false') .then((out) => { expect(out) .to.eql('added bafybeiaoh5okvpnuhndsz4kgdhulnkm566rz7w7il6r2zm6wxu5f5uqlsu less-than-default-max-chunk-size\n') @@ -256,7 +256,7 @@ describe('files', () => runOnAndOff((thing) => { it('add with cid-version=1 and raw-leaves=false > default max chunk size', function () { this.timeout(30 * 1000) - return ipfs(`add test/fixtures/greater-than-default-max-chunk-size --cid-version=1 --raw-leaves=false`) + return ipfs('add test/fixtures/greater-than-default-max-chunk-size --cid-version=1 --raw-leaves=false') .then((out) => { expect(out) .to.eql('added bafybeiajpcrr2qglyeq3biilzt25ty6kpjs7huy2lfxopqfke6riaaxnim greater-than-default-max-chunk-size\n') diff --git a/test/cli/gc.js b/test/cli/gc.js index d66c82f56d..cf11a0115a 100644 --- a/test/cli/gc.js +++ b/test/cli/gc.js @@ -34,7 +34,7 @@ describe('gc', () => { const errMsg = 'some err' const printSpy = setupMocks(cids, errMsg) - await cli.parse(`repo gc`) + await cli.parse('repo gc') const exp = cids.map(c => 'removed ' + c).concat(errMsg) for (let i = 0; i < exp.length; i++) { @@ -49,7 +49,7 @@ describe('gc', () => { ] const printSpy = setupMocks(cids) - await cli.parse(`repo gc --quiet`) + await cli.parse('repo gc --quiet') const exp = cids.map(c => c.toString()) for (let i = 0; i < exp.length; i++) { @@ -60,7 +60,7 @@ describe('gc', () => { it('gc with --stream-errors=false does not print errors', async () => { const printSpy = setupMocks([], 'some err') - await cli.parse(`repo gc --stream-errors=false`) + await cli.parse('repo gc --stream-errors=false') sinon.assert.notCalled(printSpy) }) }) diff --git a/test/cli/name.js b/test/cli/name.js index 984d777da8..19f897d360 100644 --- a/test/cli/name.js +++ b/test/cli/name.js @@ -31,7 +31,7 @@ describe('name', () => { // Force the next require to not use require cache clearModule('../../src/cli/commands/name/resolve.js') - await cli.parse(`name resolve test`) + await cli.parse('name resolve test') sinon.assert.calledWith(resolveFake, 'test', { nocache: false, recursive: true }) }) @@ -47,7 +47,7 @@ describe('name', () => { // Force the next require to not use require cache clearModule('../../src/cli/commands/name/publish.js') - await cli.parse(`name publish test --silent`) + await cli.parse('name publish test --silent') sinon.assert.calledWith(printSpy, 'Published to name: value') sinon.assert.calledWith(publishFake, 'test', { resolve: true, diff --git a/test/cli/swarm.js b/test/cli/swarm.js index 137661f84e..c8c0206e3a 100644 --- a/test/cli/swarm.js +++ b/test/cli/swarm.js @@ -128,8 +128,8 @@ describe('swarm', () => { promise.then(({ data }) => { expect(data).to.eql([ `${peerInfo.id.toB58String()} (2)`, - `\t/ip4/127.0.0.1/tcp/4001`, - `\t/ip4/127.0.0.1/tcp/4001/ws` + '\t/ip4/127.0.0.1/tcp/4001', + '\t/ip4/127.0.0.1/tcp/4001/ws' ].join('\n')) done() }) diff --git a/test/core/bitswap.spec.js b/test/core/bitswap.spec.js index 236605c4da..68506b29c6 100644 --- a/test/core/bitswap.spec.js +++ b/test/core/bitswap.spec.js @@ -70,7 +70,7 @@ function addNode (fDaemon, inProcNode, callback) { initOptions: { bits: 512 }, config: { Addresses: { - Swarm: [`/ip4/127.0.0.1/tcp/0/ws`] + Swarm: ['/ip4/127.0.0.1/tcp/0/ws'] }, Discovery: { MDNS: { diff --git a/test/core/circuit-relay.js b/test/core/circuit-relay.js index c23e75faa2..6d58176910 100644 --- a/test/core/circuit-relay.js +++ b/test/core/circuit-relay.js @@ -57,7 +57,7 @@ const wsAddr = (addrs) => addrs.map((a) => a.toString()).find((a) => a.includes( const tcpAddr = (addrs) => addrs.map((a) => a.toString()).find((a) => !a.includes('/ws')) describe('circuit relay', () => { - describe(`A <-> R <-> B`, function () { + describe('A <-> R <-> B', function () { this.timeout(80 * 1000) let nodeA diff --git a/test/core/pin-set.js b/test/core/pin-set.js index 180c32167f..21c66259b2 100644 --- a/test/core/pin-set.js +++ b/test/core/pin-set.js @@ -183,7 +183,7 @@ describe('pinSet', function () { }) describe('walkItems', function () { - it(`fails if node doesn't have a pin-set protobuf header`, function (done) { + it('fails if node doesn\'t have a pin-set protobuf header', function (done) { createNode('datum', (err, node) => { expect(err).to.not.exist() diff --git a/test/core/pin.js b/test/core/pin.js index 585cda104c..b789024b24 100644 --- a/test/core/pin.js +++ b/test/core/pin.js @@ -240,14 +240,22 @@ describe('pin', function () { return pin.ls() .then(out => expect(out).to.deep.include.members([ - { type: 'recursive', - hash: 'QmTAMavb995EHErSrKo7mB8dYkpaSJxu6ys1a6XJyB2sys' }, - { type: 'indirect', - hash: 'QmTMbkDfvHwq3Aup6Nxqn3KKw9YnoKzcZvuArAfQ9GF3QG' }, - { type: 'indirect', - hash: 'QmbJCNKXJqVK8CzbjpNFz2YekHwh3CSHpBA86uqYg3sJ8q' }, - { type: 'indirect', - hash: 'QmVgSHAdMxFAuMP2JiMAYkB8pCWP1tcB9djqvq8GKAFiHi' } + { + type: 'recursive', + hash: 'QmTAMavb995EHErSrKo7mB8dYkpaSJxu6ys1a6XJyB2sys' + }, + { + type: 'indirect', + hash: 'QmTMbkDfvHwq3Aup6Nxqn3KKw9YnoKzcZvuArAfQ9GF3QG' + }, + { + type: 'indirect', + hash: 'QmbJCNKXJqVK8CzbjpNFz2YekHwh3CSHpBA86uqYg3sJ8q' + }, + { + type: 'indirect', + hash: 'QmVgSHAdMxFAuMP2JiMAYkB8pCWP1tcB9djqvq8GKAFiHi' + } ]) ) }) @@ -256,8 +264,10 @@ describe('pin', function () { return pin.ls({ type: 'direct' }) .then(out => expect(out).to.deep.include.members([ - { type: 'direct', - hash: 'QmbJCNKXJqVK8CzbjpNFz2YekHwh3CSHpBA86uqYg3sJ8q' } + { + type: 'direct', + hash: 'QmbJCNKXJqVK8CzbjpNFz2YekHwh3CSHpBA86uqYg3sJ8q' + } ]) ) }) @@ -266,8 +276,10 @@ describe('pin', function () { return pin.ls({ type: 'recursive' }) .then(out => expect(out).to.deep.include.members([ - { type: 'recursive', - hash: 'QmTAMavb995EHErSrKo7mB8dYkpaSJxu6ys1a6XJyB2sys' } + { + type: 'recursive', + hash: 'QmTAMavb995EHErSrKo7mB8dYkpaSJxu6ys1a6XJyB2sys' + } ]) ) }) @@ -276,12 +288,18 @@ describe('pin', function () { return pin.ls({ type: 'indirect' }) .then(out => expect(out).to.deep.include.members([ - { type: 'indirect', - hash: 'QmTMbkDfvHwq3Aup6Nxqn3KKw9YnoKzcZvuArAfQ9GF3QG' }, - { type: 'indirect', - hash: 'QmbJCNKXJqVK8CzbjpNFz2YekHwh3CSHpBA86uqYg3sJ8q' }, - { type: 'indirect', - hash: 'QmVgSHAdMxFAuMP2JiMAYkB8pCWP1tcB9djqvq8GKAFiHi' } + { + type: 'indirect', + hash: 'QmTMbkDfvHwq3Aup6Nxqn3KKw9YnoKzcZvuArAfQ9GF3QG' + }, + { + type: 'indirect', + hash: 'QmbJCNKXJqVK8CzbjpNFz2YekHwh3CSHpBA86uqYg3sJ8q' + }, + { + type: 'indirect', + hash: 'QmVgSHAdMxFAuMP2JiMAYkB8pCWP1tcB9djqvq8GKAFiHi' + } ]) ) }) @@ -290,8 +308,10 @@ describe('pin', function () { return pin.ls(pins.mercuryDir, { type: 'direct' }) .then(out => expect(out).to.have.deep.members([ - { type: 'direct', - hash: pins.mercuryDir } + { + type: 'direct', + hash: pins.mercuryDir + } ]) ) }) @@ -300,8 +320,10 @@ describe('pin', function () { return pin.ls(`/ipfs/${pins.root}/mercury/`, { type: 'direct' }) .then(out => expect(out).to.have.deep.members([ - { type: 'direct', - hash: pins.mercuryDir } + { + type: 'direct', + hash: pins.mercuryDir + } ]) ) }) @@ -326,8 +348,10 @@ describe('pin', function () { return pin.ls(pins.root, { type: 'recursive' }) .then(out => expect(out).to.have.deep.members([ - { type: 'recursive', - hash: pins.root } + { + type: 'recursive', + hash: pins.root + } ]) ) }) @@ -344,8 +368,10 @@ describe('pin', function () { return pin.ls(pins.solarWiki, { type: 'indirect' }) .then(out => expect(out).to.have.deep.members([ - { type: `indirect through ${pins.root}`, - hash: pins.solarWiki } + { + type: `indirect through ${pins.root}`, + hash: pins.solarWiki + } ]) ) }) diff --git a/test/core/utils.js b/test/core/utils.js index 4da679f18a..bf9bb4060a 100644 --- a/test/core/utils.js +++ b/test/core/utils.js @@ -180,10 +180,10 @@ describe('utils', () => { }) }) - it(`should error when a link doesn't exist`, function (done) { + it('should error when a link doesn\'t exist', function (done) { utils.resolvePath(node.object, `${aboutPath}/fusion`, err => { expect(err.message).to.include( - `no link named "fusion" under QmbJCNKXJqVK8CzbjpNFz2YekHwh3CSHpBA86uqYg3sJ8q` + 'no link named "fusion" under QmbJCNKXJqVK8CzbjpNFz2YekHwh3CSHpBA86uqYg3sJ8q' ) done() }) diff --git a/test/gateway/index.js b/test/gateway/index.js index 2112d5df66..48ecd7dcff 100644 --- a/test/gateway/index.js +++ b/test/gateway/index.js @@ -234,7 +234,7 @@ describe('HTTP Gateway', function () { }) expect(resFirst.statusCode).to.equal(200) expect(resFirst.headers['etag']).to.equal(`"${cid}"`) - expect(resFirst.headers['content-disposition']).to.equal(`inline; filename*=UTF-8''pretty-name-in-utf8-%C3%B3%C3%B0%C5%9B%C3%B3%C3%B0%C5%82%C4%85%C5%9B%C5%81.txt`) + expect(resFirst.headers['content-disposition']).to.equal('inline; filename*=UTF-8\'\'pretty-name-in-utf8-%C3%B3%C3%B0%C5%9B%C3%B3%C3%B0%C5%82%C4%85%C5%9B%C5%81.txt') }) it('load a big file (15MB)', async () => { diff --git a/test/http-api/files.js b/test/http-api/files.js index d1f00e1cd1..0fc29fa5ee 100644 --- a/test/http-api/files.js +++ b/test/http-api/files.js @@ -98,7 +98,7 @@ describe('.files', () => { create: true }) .then(() => ipfs.files.cp(`/${source}`, `/${destination}`)) - .then(() => ipfs.files.ls(`/`, { + .then(() => ipfs.files.ls('/', { long: true })) .then(files => { @@ -122,7 +122,7 @@ describe('.files', () => { return ipfs.files.mkdir(`/${source}`) .then(() => ipfs.files.cp(`/${source}`, `/${destination}`)) - .then(() => ipfs.files.ls(`/`, { + .then(() => ipfs.files.ls('/', { long: true })) .then(files => { @@ -148,7 +148,7 @@ describe('.files', () => { create: true }) .then(() => ipfs.files.cp([`/${source}`, `/${destination}`])) - .then(() => ipfs.files.ls(`/`, { + .then(() => ipfs.files.ls('/', { long: true })) .then(files => { @@ -172,7 +172,7 @@ describe('.files', () => { return ipfs.files.mkdir(`/${source}`) .then(() => ipfs.files.cp([`/${source}`, `/${destination}`])) - .then(() => ipfs.files.ls(`/`, { + .then(() => ipfs.files.ls('/', { long: true })) .then(files => { @@ -196,7 +196,7 @@ describe('.files', () => { const directory = `directory-${hat()}` return ipfs.files.mkdir(`/${directory}`) - .then(() => ipfs.files.ls(`/`, { + .then(() => ipfs.files.ls('/', { long: true })) .then(files => { @@ -218,7 +218,7 @@ describe('.files', () => { create: true }) .then(() => ipfs.files.mv(`/${source}`, `/${destination}`)) - .then(() => ipfs.files.ls(`/`)) + .then(() => ipfs.files.ls('/')) .then(files => { const sourceFile = files .filter(file => file.name === source) @@ -240,7 +240,7 @@ describe('.files', () => { return ipfs.files.mkdir(`/${source}`) .then(() => ipfs.files.mv(`/${source}`, `/${destination}`)) - .then(() => ipfs.files.ls(`/`, { + .then(() => ipfs.files.ls('/', { long: true })) .then(files => { @@ -266,7 +266,7 @@ describe('.files', () => { create: true }) .then(() => ipfs.files.mv([`/${source}`, `/${destination}`])) - .then(() => ipfs.files.ls(`/`)) + .then(() => ipfs.files.ls('/')) .then(files => { const sourceFile = files .filter(file => file.name === source) @@ -288,7 +288,7 @@ describe('.files', () => { return ipfs.files.mkdir(`/${source}`) .then(() => ipfs.files.mv([`/${source}`, `/${destination}`])) - .then(() => ipfs.files.ls(`/`, { + .then(() => ipfs.files.ls('/', { long: true })) .then(files => { @@ -330,7 +330,7 @@ describe('.files', () => { create: true }) .then(() => ipfs.files.rm(`/${fileName}`)) - .then(() => ipfs.files.ls(`/`)) + .then(() => ipfs.files.ls('/')) .then(files => { const file = files .filter(file => file.name === fileName) @@ -351,7 +351,7 @@ describe('.files', () => { .then(() => ipfs.files.rm(`/${dirName}`, { recursive: true })) - .then(() => ipfs.files.ls(`/`)) + .then(() => ipfs.files.ls('/')) .then(files => { const dir = files .filter(file => file.name === dirName) diff --git a/test/http-api/inject/bootstrap.js b/test/http-api/inject/bootstrap.js index 5c791f2861..713c6be08c 100644 --- a/test/http-api/inject/bootstrap.js +++ b/test/http-api/inject/bootstrap.js @@ -55,7 +55,7 @@ module.exports = (http) => { it('/add/default', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/bootstrap/add/default` + url: '/api/v0/bootstrap/add/default' }) expect(res.statusCode).to.be.eql(200) @@ -79,7 +79,7 @@ module.exports = (http) => { it('/rm/all', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/bootstrap/rm/all` + url: '/api/v0/bootstrap/rm/all' }) expect(res.statusCode).to.be.eql(200) diff --git a/test/http-api/inject/dht.js b/test/http-api/inject/dht.js index 36ca747da4..f844658417 100644 --- a/test/http-api/inject/dht.js +++ b/test/http-api/inject/dht.js @@ -20,7 +20,7 @@ module.exports = (http) => { it('returns 400 if no peerId is provided', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/dht/findpeer` + url: '/api/v0/dht/findpeer' }) expect(res.statusCode).to.equal(400) @@ -42,7 +42,7 @@ module.exports = (http) => { it('returns 400 if no key is provided', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/dht/findprovs` + url: '/api/v0/dht/findprovs' }) expect(res.statusCode).to.equal(400) @@ -65,7 +65,7 @@ module.exports = (http) => { it('returns 400 if no key is provided', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/dht/get` + url: '/api/v0/dht/get' }) expect(res.statusCode).to.equal(400) @@ -98,7 +98,7 @@ module.exports = (http) => { it('returns 400 if no key is provided', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/dht/provide` + url: '/api/v0/dht/provide' }) expect(res.statusCode).to.equal(400) @@ -120,7 +120,7 @@ module.exports = (http) => { it('returns 400 if no key or value is provided', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/dht/put` + url: '/api/v0/dht/put' }) expect(res.statusCode).to.equal(400) diff --git a/test/http-api/inject/name.js b/test/http-api/inject/name.js index 1e723c3749..b181f2935a 100644 --- a/test/http-api/inject/name.js +++ b/test/http-api/inject/name.js @@ -44,7 +44,7 @@ module.exports = (http) => { res = await api.inject({ method: 'GET', - url: `/api/v0/name/resolve` + url: '/api/v0/name/resolve' }) expect(res).to.exist() diff --git a/test/http-api/inject/pin.js b/test/http-api/inject/pin.js index 1442639e2d..50fafe1da2 100644 --- a/test/http-api/inject/pin.js +++ b/test/http-api/inject/pin.js @@ -44,7 +44,7 @@ module.exports = (http) => { it('fails on invalid args', async () => { const res = await api.inject({ method: 'POST', - url: `/api/v0/pin/rm?arg=invalid` + url: '/api/v0/pin/rm?arg=invalid' }) expect(res.statusCode).to.equal(400) @@ -135,7 +135,7 @@ module.exports = (http) => { it('fails on invalid args', async () => { const res = await api.inject({ method: 'POST', - url: `/api/v0/pin/add?arg=invalid` + url: '/api/v0/pin/add?arg=invalid' }) expect(res.statusCode).to.equal(400) @@ -220,7 +220,7 @@ module.exports = (http) => { it('fails on invalid args', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/pin/ls?arg=invalid` + url: '/api/v0/pin/ls?arg=invalid' }) expect(res.statusCode).to.equal(400) @@ -251,7 +251,7 @@ module.exports = (http) => { it('finds pins of type', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/pin/ls?type=recursive` + url: '/api/v0/pin/ls?type=recursive' }) expect(res.statusCode).to.equal(200) @@ -275,7 +275,7 @@ module.exports = (http) => { res = await api.inject({ method: 'POST', - url: `/api/v0/pin/ls?cid-base=base64` + url: '/api/v0/pin/ls?cid-base=base64' }) expect(res.statusCode).to.equal(200) @@ -300,7 +300,7 @@ module.exports = (http) => { res = await api.inject({ method: 'POST', - url: `/api/v0/pin/ls?cid-base=invalid` + url: '/api/v0/pin/ls?cid-base=invalid' }) expect(res.statusCode).to.equal(400) diff --git a/test/http-api/inject/ping.js b/test/http-api/inject/ping.js index ef8cd3bee4..4467a05d11 100644 --- a/test/http-api/inject/ping.js +++ b/test/http-api/inject/ping.js @@ -19,7 +19,7 @@ module.exports = (http) => { it('returns 400 if both n and count are provided', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/ping?arg=peerid&n=1&count=1` + url: '/api/v0/ping?arg=peerid&n=1&count=1' }) expect(res.statusCode).to.equal(400) @@ -28,7 +28,7 @@ module.exports = (http) => { it('returns 400 if arg is not provided', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/ping?count=1` + url: '/api/v0/ping?count=1' }) expect(res.statusCode).to.equal(400) @@ -39,7 +39,7 @@ module.exports = (http) => { const res = await api.inject({ method: 'GET', - url: `/api/v0/ping?arg=peerid` + url: '/api/v0/ping?arg=peerid' }) expect(res.statusCode).to.equal(500) diff --git a/test/http-api/inject/pubsub.js b/test/http-api/inject/pubsub.js index 86cec4f078..ce1d803019 100644 --- a/test/http-api/inject/pubsub.js +++ b/test/http-api/inject/pubsub.js @@ -23,7 +23,7 @@ module.exports = (http) => { it('returns 400 if no topic is provided', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/pubsub/sub` + url: '/api/v0/pubsub/sub' }) expect(res.statusCode).to.equal(400) @@ -60,7 +60,7 @@ module.exports = (http) => { it('returns 400 if no buffer is provided', async () => { const res = await api.inject({ method: 'POST', - url: `/api/v0/pubsub/pub?arg=&arg=` + url: '/api/v0/pubsub/pub?arg=&arg=' }) expect(res.statusCode).to.equal(400) @@ -81,7 +81,7 @@ module.exports = (http) => { it('returns 200', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/pubsub/ls` + url: '/api/v0/pubsub/ls' }) expect(res.statusCode).to.equal(200) expect(res.result.Strings).to.be.eql([topic]) From 0984567167d47037303a14cb687a7a66844a570c Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Tue, 17 Sep 2019 16:44:40 +0100 Subject: [PATCH 13/18] chore: upgrade deps --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 372e64e0c6..176ef3b81f 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "ipfs-bitswap": "~0.25.1", "ipfs-block": "~0.8.1", "ipfs-block-service": "~0.15.2", - "ipfs-http-client": "ipfs/js-ipfs-http-client#fix/fix-electron", + "ipfs-http-client": "^36.1.0", "ipfs-http-response": "~0.3.1", "ipfs-mfs": "^0.12.2", "ipfs-multipart": "^0.2.0", @@ -198,7 +198,7 @@ "execa": "^2.0.4", "form-data": "^2.5.1", "hat": "0.0.3", - "interface-ipfs-core": "github:ipfs/interface-ipfs-core#fix/fix-electron", + "interface-ipfs-core": "~0.114.0", "ipfs-interop": "~0.1.0", "ipfsd-ctl": "ipfs/js-ipfsd-ctl#chore/new-http-client", "libp2p-websocket-star": "~0.10.2", From 0a9ba6e1e0d7de4d36f4ca4a27d5e5c5f840fc80 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 18 Sep 2019 12:13:43 +0100 Subject: [PATCH 14/18] fix: remove bits --- package.json | 2 +- test/core/ping.spec.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 176ef3b81f..37004e0218 100644 --- a/package.json +++ b/package.json @@ -200,7 +200,7 @@ "hat": "0.0.3", "interface-ipfs-core": "~0.114.0", "ipfs-interop": "~0.1.0", - "ipfsd-ctl": "ipfs/js-ipfsd-ctl#chore/new-http-client", + "ipfsd-ctl": "github:ipfs/js-ipfsd-ctl#chore/new-http-client", "libp2p-websocket-star": "~0.10.2", "ncp": "^2.0.0", "p-event": "^4.1.0", diff --git a/test/core/ping.spec.js b/test/core/ping.spec.js index 9de8966f4a..f05b97d556 100644 --- a/test/core/ping.spec.js +++ b/test/core/ping.spec.js @@ -36,7 +36,6 @@ const spawnNode = ({ dht = false, type = 'js' }) => { return factory.spawn({ args, config, - initOptions: { bits: 512 }, preload: { enabled: false } }) } From 91bfe1595adc8393fa6c96b8ca991b4287f2663e Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 20 Sep 2019 11:31:04 +0100 Subject: [PATCH 15/18] fix: update deps and some test tweaks --- package.json | 6 +++--- test/core/bitswap.spec.js | 2 +- test/core/gc.spec.js | 3 +-- test/core/name.spec.js | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 37004e0218..e17dc112ef 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "ipfs-bitswap": "~0.25.1", "ipfs-block": "~0.8.1", "ipfs-block-service": "~0.15.2", - "ipfs-http-client": "^36.1.0", + "ipfs-http-client": "^37.0.2", "ipfs-http-response": "~0.3.1", "ipfs-mfs": "^0.12.2", "ipfs-multipart": "^0.2.0", @@ -187,7 +187,7 @@ "yargs-promise": "^1.1.0" }, "devDependencies": { - "aegir": "^20.2.0", + "aegir": "^20.3.1", "base64url": "^3.0.1", "chai": "^4.2.0", "clear-module": "^4.0.0", @@ -200,7 +200,7 @@ "hat": "0.0.3", "interface-ipfs-core": "~0.114.0", "ipfs-interop": "~0.1.0", - "ipfsd-ctl": "github:ipfs/js-ipfsd-ctl#chore/new-http-client", + "ipfsd-ctl": "^0.47.2", "libp2p-websocket-star": "~0.10.2", "ncp": "^2.0.0", "p-event": "^4.1.0", diff --git a/test/core/bitswap.spec.js b/test/core/bitswap.spec.js index 68506b29c6..a432e3a657 100644 --- a/test/core/bitswap.spec.js +++ b/test/core/bitswap.spec.js @@ -13,7 +13,7 @@ const waterfall = require('async/waterfall') const parallel = require('async/parallel') const Block = require('ipfs-block') const multiaddr = require('multiaddr') -const isNode = require('detect-node') +const isNode = require('ipfs-utils/src/env') const multihashing = require('multihashing-async') const CID = require('cids') const path = require('path') diff --git a/test/core/gc.spec.js b/test/core/gc.spec.js index ab3e148a7c..3fc007d30a 100644 --- a/test/core/gc.spec.js +++ b/test/core/gc.spec.js @@ -35,6 +35,7 @@ class MutexEmitter extends Mutex { } describe('gc', function () { + this.timeout(40 * 1000) const fixtures = [{ path: 'test/my/path1', content: Buffer.from('path1') @@ -54,8 +55,6 @@ describe('gc', function () { let lockEmitter before(async function () { - this.timeout(40 * 1000) - const factory = IPFSFactory.create({ type: 'proc', exec: IPFS }) const config = { Bootstrap: [] } diff --git a/test/core/name.spec.js b/test/core/name.spec.js index c17e2577d8..edef66c500 100644 --- a/test/core/name.spec.js +++ b/test/core/name.spec.js @@ -39,11 +39,11 @@ const publishAndResolve = (publisher, resolver, ipfsRef, publishOpts, nodeId, re describe('name', function () { describe('republisher', function () { + this.timeout(40 * 1000) let node let ipfsd before(async function () { - this.timeout(40 * 1000) ipfsd = await df.spawn({ exec: IPFS, args: [`--pass ${hat()}`, '--offline'], From bb91c2ebadfc50dd23c6d97f9540f0520db91dbd Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 20 Sep 2019 17:07:01 +0100 Subject: [PATCH 16/18] chore: fix isNode --- package.json | 2 +- test/core/bitswap.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e17dc112ef..38a218435a 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "ipfs-unixfs": "~0.1.16", "ipfs-unixfs-exporter": "~0.37.7", "ipfs-unixfs-importer": "~0.39.11", - "ipfs-utils": "~0.2.0", + "ipfs-utils": "~0.4.0", "ipld": "~0.24.1", "ipld-bitcoin": "~0.3.0", "ipld-dag-cbor": "~0.15.0", diff --git a/test/core/bitswap.spec.js b/test/core/bitswap.spec.js index a432e3a657..df98ffb8df 100644 --- a/test/core/bitswap.spec.js +++ b/test/core/bitswap.spec.js @@ -13,7 +13,7 @@ const waterfall = require('async/waterfall') const parallel = require('async/parallel') const Block = require('ipfs-block') const multiaddr = require('multiaddr') -const isNode = require('ipfs-utils/src/env') +const { isNode } = require('ipfs-utils/src/env') const multihashing = require('multihashing-async') const CID = require('cids') const path = require('path') From 68ff2ce284b4d4ab523917abd366749ac33925b8 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 25 Sep 2019 12:37:07 +0200 Subject: [PATCH 17/18] fix: fix interop tests this can be improve directly in aegir --- .travis.yml | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6d6a0f7d1e..a4def476e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,18 +53,39 @@ jobs: name: electron-main os: osx script: - - npx aegir test -t electron-main -- --bail --timeout 10000 + - npx aegir test -t electron-main --bail --timeout 10000 - stage: test name: electron-renderer os: osx script: - - npx aegir test -t electron-renderer -- --bail --timeout 10000 + - npx aegir test -t electron-renderer --bail --timeout 10000 - stage: test - name: interop + name: interop node script: - - npm run test:interop + - cd node_modules/ipfs-interop + - IPFS_JS_EXEC=./../../src/cli/bin.js IPFS_REUSEPORT=false npx aegir test -t node --bail + + - stage: test + name: interop browser + script: + - cd node_modules/ipfs-interop + - IPFS_JS_EXEC=./../../src/cli/bin.js IPFS_REUSEPORT=false npx aegir test -t browser --bail + + - stage: test + name: interop electron-main + os: osx + script: + - cd node_modules/ipfs-interop + - IPFS_JS_EXEC=./../../src/cli/bin.js IPFS_REUSEPORT=false npx aegir test -t electron-main -f ./test/node.js --bail --timeout 10000 + + - stage: test + name: interop electron-renderer + os: osx + script: + - cd node_modules/ipfs-interop + - IPFS_JS_EXEC=./../../src/cli/bin.js IPFS_REUSEPORT=false npx aegir test -t electron-renderer -f ./test/browser.js --bail --timeout 10000 - stage: tag if: branch = master AND type = push AND fork = false From 7faf0da1d645eaea55a37cd1efc139fc56293179 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Wed, 25 Sep 2019 16:31:30 +0100 Subject: [PATCH 18/18] test: add assertions to test to ensure daemon auto-initted --- test/cli/daemon.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/cli/daemon.js b/test/cli/daemon.js index 20481dcc1a..1ec3379fc9 100644 --- a/test/cli/daemon.js +++ b/test/cli/daemon.js @@ -283,8 +283,11 @@ describe('daemon', () => { } }) - it('should init by default if not already', async function () { + it('should init by default', async function () { this.timeout(100 * 1000) + + expect(fs.existsSync(repoPath)).to.be.false() + const daemon = ipfs('daemon') let stdout = '' @@ -302,6 +305,8 @@ describe('daemon', () => { } catch (err) { expect(err.killed).to.be.true() } + + expect(fs.existsSync(repoPath)).to.be.true() }) it('should init with custom config', async function () {