From 2278822e439d6dbb3af4756719468562cf6cffc9 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 13 Sep 2019 13:22:43 +0100 Subject: [PATCH 01/49] fix: enable a bunch of tests in the browser --- .aegir.js | 25 ++++++++++-- test/get.spec.js | 14 ++----- test/interface.spec.js | 88 +++++++++++++++++++----------------------- 3 files changed, 64 insertions(+), 63 deletions(-) diff --git a/.aegir.js b/.aegir.js index d85e96ca8..49122de98 100644 --- a/.aegir.js +++ b/.aegir.js @@ -1,9 +1,13 @@ 'use strict' +const promisify = require('promisify-es6') const createServer = require('ipfsd-ctl').createServer - +const EchoServer = require('interface-ipfs-core/src/utils/echo-http-server') const server = createServer() +const echoServer = EchoServer.createServer() +const echoServeStart = promisify(echoServer.start) +const echoServeStop = promisify(echoServer.stop) module.exports = { bundlesize: { maxSize: '245kB' }, webpack: { @@ -22,9 +26,24 @@ module.exports = { singleRun: true }, hooks: { + node: { + pre: () => echoServeStart(), + post: () => echoServeStop() + }, browser: { - pre: () => server.start(), - post: () => server.stop() + pre: () => { + return Promise.all([ + server.start(), + echoServeStart() + + ]) + }, + post: () => { + return Promise.all([ + server.stop(), + echoServeStop() + ]) + } } } } diff --git a/test/get.spec.js b/test/get.spec.js index acdcf833b..05a29ffab 100644 --- a/test/get.spec.js +++ b/test/get.spec.js @@ -9,7 +9,6 @@ const chaiAsPromised = require('chai-as-promised') const expect = chai.expect chai.use(dirtyChai) chai.use(chaiAsPromised) -const isNode = require('detect-node') const loadFixture = require('aegir/fixtures') const ipfsClient = require('../src') @@ -75,26 +74,19 @@ describe('.get (specific go-ipfs features)', function () { }) it('add path containing "+"s (for testing get)', async () => { - if (!isNode) { - return - } - const filename = 'ti,c64x+mega++mod-pic.txt' const subdir = 'tmp/c++files' const expectedCid = 'QmPkmARcqjo5fqK1V1o8cFsuaXxWYsnwCNLJUYS4KeZyff' + const path = `${subdir}/${filename}` const files = await ipfs.add([{ - path: subdir + '/' + filename, - content: Buffer.from(subdir + '/' + filename, 'utf-8') + path, + content: Buffer.from(path) }]) expect(files[2].hash).to.equal(expectedCid) }) it('get path containing "+"s', async () => { - if (!isNode) { - return - } - const cid = 'QmPkmARcqjo5fqK1V1o8cFsuaXxWYsnwCNLJUYS4KeZyff' let count = 0 const files = await ipfs.get(cid) diff --git a/test/interface.spec.js b/test/interface.spec.js index c51fc7e39..b437efea8 100644 --- a/test/interface.spec.js +++ b/test/interface.spec.js @@ -102,40 +102,30 @@ describe('interface-ipfs-core tests', () => { tests.filesRegular(defaultCommonFactory, { skip: [ - // .add - isNode ? null : { - name: 'should add a nested directory as array of tupples', - reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' - }, - isNode ? null : { - name: 'should add a nested directory as array of tupples with progress', - reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' - }, - // .addPullStream - isNode ? null : { - name: 'should add pull stream of valid files and dirs', - reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' - }, - // .addReadableStream - isNode ? null : { - name: 'should add readable stream of valid files and dirs', - reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' - }, + // // .add + // isNode ? null : { + // name: 'should add a nested directory as array of tupples', + // reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' + // }, + // isNode ? null : { + // name: 'should add a nested directory as array of tupples with progress', + // reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' + // }, + // // .addPullStream + // isNode ? null : { + // name: 'should add pull stream of valid files and dirs', + // reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' + // }, + // // .addReadableStream + // isNode ? null : { + // name: 'should add readable stream of valid files and dirs', + // reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' + // }, // .addFromFs isNode ? null : { name: 'addFromFs', reason: 'Not designed to run in the browser' }, - // .addFromURL - isNode ? null : { - name: 'addFromURL', - reason: 'Not designed to run in the browser' - }, - // TODO: remove when interface-ipfs-core updated - isNode ? null : { - name: 'addFromUrl', - reason: 'Not designed to run in the browser' - }, // .catPullStream { name: 'should export a chunk of a file', @@ -148,27 +138,27 @@ describe('interface-ipfs-core tests', () => { { name: 'should export a chunk of a file in a Readable Stream', reason: 'TODO not implemented in go-ipfs yet' - }, - // .get - isNode ? null : { - name: 'should get a directory', - reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' - }, - // .ls - isNode ? null : { - name: 'should ls with a base58 encoded CID', - reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' - }, - // .lsPullStream - isNode ? null : { - name: 'should pull stream ls with a base58 encoded CID', - reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' - }, - // .lsReadableStream - isNode ? null : { - name: 'should readable stream ls with a base58 encoded CID', - reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' } + // // .get + // isNode ? null : { + // name: 'should get a directory', + // reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' + // }, + // // .ls + // isNode ? null : { + // name: 'should ls with a base58 encoded CID', + // reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' + // }, + // // .lsPullStream + // isNode ? null : { + // name: 'should pull stream ls with a base58 encoded CID', + // reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' + // }, + // // .lsReadableStream + // isNode ? null : { + // name: 'should readable stream ls with a base58 encoded CID', + // reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' + // } ] }) From 87d444ef19472044f988d7156e67a5ef66f4820e Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 13 Sep 2019 13:23:42 +0100 Subject: [PATCH 02/49] fix: Blob can accept Buffer directly Buffer.buffer triggered a super weird bug in electron renderer --- src/add/form-data.browser.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/add/form-data.browser.js b/src/add/form-data.browser.js index 8e228c164..247396c42 100644 --- a/src/add/form-data.browser.js +++ b/src/add/form-data.browser.js @@ -1,7 +1,6 @@ 'use strict' /* eslint-env browser */ -const { Buffer } = require('buffer') const normaliseInput = require('ipfs-utils/src/files/normalise-input') exports.toFormData = async input => { @@ -16,12 +15,12 @@ exports.toFormData = async input => { // One day, this will be browser streams const bufs = [] for await (const chunk of file.content) { - bufs.push(Buffer.isBuffer(chunk) ? chunk.buffer : chunk) + bufs.push(chunk) } - formData.append(`file-${i}`, new Blob(bufs, { type: 'application/octet-stream' }), file.path) + formData.append(`file-${i}`, new Blob(bufs, { type: 'application/octet-stream' }), encodeURIComponent(file.path)) } else { - formData.append(`dir-${i}`, new Blob([], { type: 'application/x-directory' }), file.path) + formData.append(`dir-${i}`, new Blob([], { type: 'application/x-directory' }), encodeURIComponent(file.path)) } i++ From 080b4b98afa8953b945357982950557370926ded Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 13 Sep 2019 13:24:22 +0100 Subject: [PATCH 03/49] fix: temp fix for electron renderer until ky-universal is fixed --- .travis.yml | 5 ----- package.json | 8 ++++---- src/add/form-data.js | 7 +++++++ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 21dbade12..368b6e6df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,11 +18,6 @@ script: npx nyc -s npm run test:node -- --bail after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov jobs: - allow_failures: - - name: electron-renderer - - fast_finish: true - include: - stage: check script: diff --git a/package.json b/package.json index 3f410a087..14e6804d7 100644 --- a/package.json +++ b/package.json @@ -99,15 +99,15 @@ "through2": "^3.0.1" }, "devDependencies": { - "aegir": "^20.0.0", + "aegir": "^20.1.0", "browser-process-platform": "~0.1.1", "chai": "^4.2.0", "chai-as-promised": "^7.1.1", - "cross-env": "^5.2.0", + "cross-env": "^5.2.1", "dirty-chai": "^2.0.1", "go-ipfs-dep": "^0.4.22", - "interface-ipfs-core": "^0.112.0", - "ipfsd-ctl": "~0.45.0", + "interface-ipfs-core": "^0.113.0", + "ipfsd-ctl": "~0.46.1", "nock": "^11.3.2", "stream-equal": "^1.1.1" }, diff --git a/src/add/form-data.js b/src/add/form-data.js index 2465ce2e3..7e56d5605 100644 --- a/src/add/form-data.js +++ b/src/add/form-data.js @@ -4,6 +4,7 @@ const FormData = require('form-data') const { Buffer } = require('buffer') const toStream = require('it-to-stream') const normaliseInput = require('ipfs-utils/src/files/normalise-input') +const { isElectronRenderer } = require('ipfs-utils/src/env') exports.toFormData = async input => { const files = normaliseInput(input) @@ -40,3 +41,9 @@ exports.toFormData = async input => { return formData } + +// TODO remove this when upstream fix for ky-universal is merged +// also this should only be necessary when nodeIntegration is false in electron renderer +if (isElectronRenderer) { + exports.toFormData = require('./form-data.browser').toFormData +} From 000e00cadc825c6367acf8c478309839ad8806fc Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 13 Sep 2019 13:25:39 +0100 Subject: [PATCH 04/49] chore: use interface-core branch with fixes --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 14e6804d7..be53707fd 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,7 @@ "cross-env": "^5.2.1", "dirty-chai": "^2.0.1", "go-ipfs-dep": "^0.4.22", - "interface-ipfs-core": "^0.113.0", + "interface-ipfs-core": "ipfs/interface-js-ipfs-core#fix/electron-renderer", "ipfsd-ctl": "~0.46.1", "nock": "^11.3.2", "stream-equal": "^1.1.1" From d51868371994b83c3a7476f2997b155364fb28aa Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 13 Sep 2019 13:32:03 +0100 Subject: [PATCH 05/49] chore: update interface-core --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index be53707fd..91bb6cc0a 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,7 @@ "cross-env": "^5.2.1", "dirty-chai": "^2.0.1", "go-ipfs-dep": "^0.4.22", - "interface-ipfs-core": "ipfs/interface-js-ipfs-core#fix/electron-renderer", + "interface-ipfs-core": "^0.113.1", "ipfsd-ctl": "~0.46.1", "nock": "^11.3.2", "stream-equal": "^1.1.1" From ee5fd826f9515d0ad08102f7a7b337fc0b4d74cc Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 13 Sep 2019 13:38:12 +0100 Subject: [PATCH 06/49] chore: fix typo --- .aegir.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.aegir.js b/.aegir.js index 49122de98..60ca266da 100644 --- a/.aegir.js +++ b/.aegir.js @@ -6,8 +6,8 @@ const EchoServer = require('interface-ipfs-core/src/utils/echo-http-server') const server = createServer() const echoServer = EchoServer.createServer() -const echoServeStart = promisify(echoServer.start) -const echoServeStop = promisify(echoServer.stop) +const echoServerStart = promisify(echoServer.start) +const echoServerStop = promisify(echoServer.stop) module.exports = { bundlesize: { maxSize: '245kB' }, webpack: { @@ -27,21 +27,21 @@ module.exports = { }, hooks: { node: { - pre: () => echoServeStart(), - post: () => echoServeStop() + pre: () => echoServerStart(), + post: () => echoServerStop() }, browser: { pre: () => { return Promise.all([ server.start(), - echoServeStart() + echoServerStart() ]) }, post: () => { return Promise.all([ server.stop(), - echoServeStop() + echoServerStop() ]) } } From 05e4bbaa3c1dada0832487269830d9f435d8f21c Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 13 Sep 2019 14:59:59 +0100 Subject: [PATCH 07/49] fix: try to fix ci --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 368b6e6df..858a6c7f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,8 @@ stages: - cov node_js: - - '10' - '12' + - '10' os: - linux From d0b77c35fb08a336f97c88e0b08c4b5a86daf89d Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 13 Sep 2019 16:16:05 +0100 Subject: [PATCH 08/49] chore: testing timing for wantlist tests --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 91bb6cc0a..556ea4a6e 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,7 @@ "cross-env": "^5.2.1", "dirty-chai": "^2.0.1", "go-ipfs-dep": "^0.4.22", - "interface-ipfs-core": "^0.113.1", + "interface-ipfs-core": "ipfs/interface-js-ipfs-core#fix/wantlist-renderer", "ipfsd-ctl": "~0.46.1", "nock": "^11.3.2", "stream-equal": "^1.1.1" From 99660257c5f7057ad926cd6f815985f1e29d002b Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 13 Sep 2019 16:37:57 +0100 Subject: [PATCH 09/49] chore: run everything in ci --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 858a6c7f2..ad31323a2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,7 +45,7 @@ jobs: - stage: test name: electron-renderer script: - - xvfb-run npx aegir test -t electron-renderer -- --bail + - xvfb-run npx aegir test -t electron-renderer notifications: email: false From 61c5917a71308857806baa14ff5072533869149a Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 13 Sep 2019 17:04:10 +0100 Subject: [PATCH 10/49] chore: test travis --- test/interface.spec.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/interface.spec.js b/test/interface.spec.js index b437efea8..1db42c89f 100644 --- a/test/interface.spec.js +++ b/test/interface.spec.js @@ -187,6 +187,11 @@ describe('interface-ipfs-core tests', () => { }) tests.miscellaneous(defaultCommonFactory, { + only: [ + { + name: 'should resolve an IPFS hash' + } + ], skip: [ // stop { From 02c44506a3194d6e9e65f6ebf477f71e6ad39873 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 13 Sep 2019 17:08:44 +0100 Subject: [PATCH 11/49] chore: remove travis cache --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ad31323a2..74fe810fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: node_js -cache: npm +# cache: npm +cache: false stages: - check - test From a8d820e6cfecf2e76bbd98d0df7761d22c0ee29d Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 13 Sep 2019 17:12:22 +0100 Subject: [PATCH 12/49] chore: disable more stuff --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 74fe810fc..fc7b8c0a6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,8 +22,8 @@ jobs: include: - stage: check script: - - npx aegir build --bundlesize - - npx aegir dep-check + # - npx aegir build --bundlesize + # - npx aegir dep-check - npm run lint - stage: test From 4106720a7992309bc98654ad5bdab16fbee34a81 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 13 Sep 2019 17:13:11 +0100 Subject: [PATCH 13/49] chore: disable more stuff 2 --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index fc7b8c0a6..2d5f599b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: node_js # cache: npm cache: false stages: - - check + # - check - test - cov @@ -20,11 +20,11 @@ after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codeco jobs: include: - - stage: check - script: + # - stage: check + # script: # - npx aegir build --bundlesize # - npx aegir dep-check - - npm run lint + # - npm run lint - stage: test name: chrome From a289ab4b45f79eb1ce4990677bdeb3c588ab27ea Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 13 Sep 2019 18:18:00 +0100 Subject: [PATCH 14/49] chore: test travis 2 --- package.json | 2 +- src/id.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 556ea4a6e..b1371d9ac 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,7 @@ "cross-env": "^5.2.1", "dirty-chai": "^2.0.1", "go-ipfs-dep": "^0.4.22", - "interface-ipfs-core": "ipfs/interface-js-ipfs-core#fix/wantlist-renderer", + "interface-ipfs-core": "github:ipfs/interface-js-ipfs-core#fix/wantlist-renderer", "ipfsd-ctl": "~0.46.1", "nock": "^11.3.2", "stream-equal": "^1.1.1" diff --git a/src/id.js b/src/id.js index 1db0f7a0c..f14fe57c6 100644 --- a/src/id.js +++ b/src/id.js @@ -11,6 +11,7 @@ module.exports = (arg) => { callback = opts opts = undefined } + send({ path: 'id', args: opts @@ -18,6 +19,7 @@ module.exports = (arg) => { if (err) { return callback(err) } + console.log('IDDDDDDDDDDDDDDD', result) const identity = { id: result.ID, publicKey: result.PublicKey, From dd977ad55f3590e3da471279ae9034c3dc184cd4 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 13 Sep 2019 18:23:19 +0100 Subject: [PATCH 15/49] chore: test travis 3 --- src/id.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/id.js b/src/id.js index f14fe57c6..b98be8443 100644 --- a/src/id.js +++ b/src/id.js @@ -19,7 +19,6 @@ module.exports = (arg) => { if (err) { return callback(err) } - console.log('IDDDDDDDDDDDDDDD', result) const identity = { id: result.ID, publicKey: result.PublicKey, From 2b707bffe420e19b8b5bd699313398e7ed759be1 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 13 Sep 2019 18:26:51 +0100 Subject: [PATCH 16/49] chore: test travis 4 --- src/id.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/id.js b/src/id.js index b98be8443..fbcb7cbc5 100644 --- a/src/id.js +++ b/src/id.js @@ -16,6 +16,7 @@ module.exports = (arg) => { path: 'id', args: opts }, (err, result) => { + console.log('TCL: result', result) if (err) { return callback(err) } From 4f571f656334da7abb956b956b7d756e86a52acf Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 13 Sep 2019 18:31:26 +0100 Subject: [PATCH 17/49] chore: test travis 5 --- src/id.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/id.js b/src/id.js index fbcb7cbc5..b98be8443 100644 --- a/src/id.js +++ b/src/id.js @@ -16,7 +16,6 @@ module.exports = (arg) => { path: 'id', args: opts }, (err, result) => { - console.log('TCL: result', result) if (err) { return callback(err) } From 9b8e60f71f198417ac47ef11af32b992d25c028a Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 13 Sep 2019 19:26:11 +0100 Subject: [PATCH 18/49] fix: update deps --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b1371d9ac..38c244fa9 100644 --- a/package.json +++ b/package.json @@ -106,8 +106,8 @@ "cross-env": "^5.2.1", "dirty-chai": "^2.0.1", "go-ipfs-dep": "^0.4.22", - "interface-ipfs-core": "github:ipfs/interface-js-ipfs-core#fix/wantlist-renderer", - "ipfsd-ctl": "~0.46.1", + "interface-ipfs-core": "^0.113.1", + "ipfsd-ctl": "ipfs/js-ipfsd-ctl#fix/fix-electron", "nock": "^11.3.2", "stream-equal": "^1.1.1" }, From c97508c4b6cc5419da5a5396ea4bd6a064aa1c78 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 13 Sep 2019 19:52:37 +0100 Subject: [PATCH 19/49] fix: revert --- .travis.yml | 17 ++++++++--------- package.json | 2 +- test/interface.spec.js | 5 ----- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2d5f599b0..858a6c7f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,7 @@ language: node_js -# cache: npm -cache: false +cache: npm stages: - # - check + - check - test - cov @@ -20,11 +19,11 @@ after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codeco jobs: include: - # - stage: check - # script: - # - npx aegir build --bundlesize - # - npx aegir dep-check - # - npm run lint + - stage: check + script: + - npx aegir build --bundlesize + - npx aegir dep-check + - npm run lint - stage: test name: chrome @@ -46,7 +45,7 @@ jobs: - stage: test name: electron-renderer script: - - xvfb-run npx aegir test -t electron-renderer + - xvfb-run npx aegir test -t electron-renderer -- --bail notifications: email: false diff --git a/package.json b/package.json index 38c244fa9..21826ddcc 100644 --- a/package.json +++ b/package.json @@ -107,7 +107,7 @@ "dirty-chai": "^2.0.1", "go-ipfs-dep": "^0.4.22", "interface-ipfs-core": "^0.113.1", - "ipfsd-ctl": "ipfs/js-ipfsd-ctl#fix/fix-electron", + "ipfsd-ctl": "github:ipfs/js-ipfsd-ctl#fix/fix-electron", "nock": "^11.3.2", "stream-equal": "^1.1.1" }, diff --git a/test/interface.spec.js b/test/interface.spec.js index 1db42c89f..b437efea8 100644 --- a/test/interface.spec.js +++ b/test/interface.spec.js @@ -187,11 +187,6 @@ describe('interface-ipfs-core tests', () => { }) tests.miscellaneous(defaultCommonFactory, { - only: [ - { - name: 'should resolve an IPFS hash' - } - ], skip: [ // stop { From 276092b9ba3c5b4c582bd82b9036b0b90581d666 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 13 Sep 2019 20:05:06 +0100 Subject: [PATCH 20/49] fix: travis again --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 858a6c7f2..ad31323a2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,7 +45,7 @@ jobs: - stage: test name: electron-renderer script: - - xvfb-run npx aegir test -t electron-renderer -- --bail + - xvfb-run npx aegir test -t electron-renderer notifications: email: false From 2e6555cb0926edef7058fa392588af8ade7dc711 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 13 Sep 2019 20:15:36 +0100 Subject: [PATCH 21/49] fix: travis again 2 --- .travis.yml | 16 +++++++++------- test/interface.spec.js | 5 +++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index ad31323a2..e4d8e2894 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,9 @@ language: node_js -cache: npm +# cache: npm +cache: false + stages: - - check + # - check - test - cov @@ -19,11 +21,11 @@ after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codeco jobs: include: - - stage: check - script: - - npx aegir build --bundlesize - - npx aegir dep-check - - npm run lint + # - stage: check + # script: + # - npx aegir build --bundlesize + # - npx aegir dep-check + # - npm run lint - stage: test name: chrome diff --git a/test/interface.spec.js b/test/interface.spec.js index b437efea8..1db42c89f 100644 --- a/test/interface.spec.js +++ b/test/interface.spec.js @@ -187,6 +187,11 @@ describe('interface-ipfs-core tests', () => { }) tests.miscellaneous(defaultCommonFactory, { + only: [ + { + name: 'should resolve an IPFS hash' + } + ], skip: [ // stop { From 792800b5de9b75f0992d315d95e98468efe80450 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 08:24:18 +0100 Subject: [PATCH 22/49] fix: enable more test --- test/interface.spec.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/interface.spec.js b/test/interface.spec.js index 1db42c89f..945b4a4fe 100644 --- a/test/interface.spec.js +++ b/test/interface.spec.js @@ -54,6 +54,7 @@ describe('interface-ipfs-core tests', () => { }) tests.dag(defaultCommonFactory, { + only: true, skip: [ // dag.tree { @@ -187,11 +188,7 @@ describe('interface-ipfs-core tests', () => { }) tests.miscellaneous(defaultCommonFactory, { - only: [ - { - name: 'should resolve an IPFS hash' - } - ], + only: true, skip: [ // stop { From ece1171c2634d88d9403c21c4f65d41b45cdf937 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 08:48:06 +0100 Subject: [PATCH 23/49] fix: debug --- test/interface.spec.js | 7 +++++-- test/utils/interface-common-factory.js | 10 ++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/test/interface.spec.js b/test/interface.spec.js index 945b4a4fe..89416a56c 100644 --- a/test/interface.spec.js +++ b/test/interface.spec.js @@ -54,7 +54,6 @@ describe('interface-ipfs-core tests', () => { }) tests.dag(defaultCommonFactory, { - only: true, skip: [ // dag.tree { @@ -188,7 +187,11 @@ describe('interface-ipfs-core tests', () => { }) tests.miscellaneous(defaultCommonFactory, { - only: true, + only: [ + { + name: 'should get the node version' + } + ], skip: [ // stop { diff --git a/test/utils/interface-common-factory.js b/test/utils/interface-common-factory.js index 6f1cad7ca..cf6609f65 100644 --- a/test/utils/interface-common-factory.js +++ b/test/utils/interface-common-factory.js @@ -26,8 +26,14 @@ function createFactory (options) { ipfsFactory.spawn(options.spawnOptions) .then((ipfsd) => { nodes.push(ipfsd) - cb(null, ipfsClient(ipfsd.apiAddr)) - }, cb) + console.log('TCL: spawnNode -> ipfsd', ipfsd) + + setImmediate(() => cb(null, ipfsClient(ipfsd.apiAddr))) + }) + .catch(err => { + console.log('TCL: spawnNode -> err', err) + setImmediate(() => cb(err)) + }) } }) } From 0e7140d7849eea721a765056d26cca38a5dc8e87 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 08:52:48 +0100 Subject: [PATCH 24/49] fix: enable more tests --- test/interface.spec.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/interface.spec.js b/test/interface.spec.js index 89416a56c..945b4a4fe 100644 --- a/test/interface.spec.js +++ b/test/interface.spec.js @@ -54,6 +54,7 @@ describe('interface-ipfs-core tests', () => { }) tests.dag(defaultCommonFactory, { + only: true, skip: [ // dag.tree { @@ -187,11 +188,7 @@ describe('interface-ipfs-core tests', () => { }) tests.miscellaneous(defaultCommonFactory, { - only: [ - { - name: 'should get the node version' - } - ], + only: true, skip: [ // stop { From 4e6440b80cf54dbba21c4a641698f1ca365902e1 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 09:12:37 +0100 Subject: [PATCH 25/49] fix: dup --- test/interface.spec.js | 1 - test/utils/interface-common-factory.js | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/interface.spec.js b/test/interface.spec.js index 945b4a4fe..20d7db6ed 100644 --- a/test/interface.spec.js +++ b/test/interface.spec.js @@ -54,7 +54,6 @@ describe('interface-ipfs-core tests', () => { }) tests.dag(defaultCommonFactory, { - only: true, skip: [ // dag.tree { diff --git a/test/utils/interface-common-factory.js b/test/utils/interface-common-factory.js index cf6609f65..25c100510 100644 --- a/test/utils/interface-common-factory.js +++ b/test/utils/interface-common-factory.js @@ -26,7 +26,9 @@ function createFactory (options) { ipfsFactory.spawn(options.spawnOptions) .then((ipfsd) => { nodes.push(ipfsd) - console.log('TCL: spawnNode -> ipfsd', ipfsd) + console.log('TCL: spawnNode -> ipfsd', ipfsd.apiAddr) + console.log('TCL: spawnNode -> ipfsd', ipfsd.initialized) + console.log('TCL: spawnNode -> ipfsd', ipfsd.started) setImmediate(() => cb(null, ipfsClient(ipfsd.apiAddr))) }) From dd9c57ab8245ca7fa8dd916f6c8c95dfb7901c08 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 09:20:27 +0100 Subject: [PATCH 26/49] fix: just 3 --- test/interface.spec.js | 6 +++++- test/utils/interface-common-factory.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/interface.spec.js b/test/interface.spec.js index 20d7db6ed..7e1897747 100644 --- a/test/interface.spec.js +++ b/test/interface.spec.js @@ -187,7 +187,11 @@ describe('interface-ipfs-core tests', () => { }) tests.miscellaneous(defaultCommonFactory, { - only: true, + only: [ + { name: 'should get the node ID (promised)' }, + { name: 'should get the node version' }, + { name: 'should resolve an IPFS hash' } + ], skip: [ // stop { diff --git a/test/utils/interface-common-factory.js b/test/utils/interface-common-factory.js index 25c100510..b0da3d4bb 100644 --- a/test/utils/interface-common-factory.js +++ b/test/utils/interface-common-factory.js @@ -26,7 +26,7 @@ function createFactory (options) { ipfsFactory.spawn(options.spawnOptions) .then((ipfsd) => { nodes.push(ipfsd) - console.log('TCL: spawnNode -> ipfsd', ipfsd.apiAddr) + console.log('TCL: spawnNode -> ipfsd', ipfsd._apiAddr) console.log('TCL: spawnNode -> ipfsd', ipfsd.initialized) console.log('TCL: spawnNode -> ipfsd', ipfsd.started) From 878ff3e4c30f0191b1e9c37b04f19ecd99a55b22 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 09:28:58 +0100 Subject: [PATCH 27/49] fix: just 3 --- test/utils/interface-common-factory.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/utils/interface-common-factory.js b/test/utils/interface-common-factory.js index b0da3d4bb..54b4d30aa 100644 --- a/test/utils/interface-common-factory.js +++ b/test/utils/interface-common-factory.js @@ -8,7 +8,7 @@ const ipfsClient = require('../../src') function createFactory (options) { options = options || {} - options.factoryOptions = options.factoryOptions || {} + options.factoryOptions = options.factoryOptions || { IpfsClient: ipfsClient } options.spawnOptions = options.spawnOptions || { initOptions: { bits: 1024, profile: 'test' } } const ipfsFactory = IPFSFactory.create(options.factoryOptions) @@ -23,14 +23,15 @@ function createFactory (options) { setup = (callback) => { callback(null, { spawnNode (cb) { + console.log('TCL: spawnNode -> spawn') ipfsFactory.spawn(options.spawnOptions) .then((ipfsd) => { nodes.push(ipfsd) - console.log('TCL: spawnNode -> ipfsd', ipfsd._apiAddr) + console.log('TCL: spawnNode -> ipfsd', ipfsd._apiAddr.toString()) console.log('TCL: spawnNode -> ipfsd', ipfsd.initialized) console.log('TCL: spawnNode -> ipfsd', ipfsd.started) - setImmediate(() => cb(null, ipfsClient(ipfsd.apiAddr))) + setImmediate(() => cb(null, ipfsd.api)) }) .catch(err => { console.log('TCL: spawnNode -> err', err) From 2c8c0cadfca45d663ab40be3eb03da85a477629c Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 11:05:57 +0100 Subject: [PATCH 28/49] chore: debug stop --- test/utils/interface-common-factory.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/utils/interface-common-factory.js b/test/utils/interface-common-factory.js index 54b4d30aa..48fece6df 100644 --- a/test/utils/interface-common-factory.js +++ b/test/utils/interface-common-factory.js @@ -45,7 +45,12 @@ function createFactory (options) { if (options.createTeardown) { teardown = options.createTeardown({ ipfsFactory, nodes }, options) } else { - teardown = callback => each(nodes, (node, cb) => node.stop().then(cb, cb), callback) + teardown = callback => each(nodes, (node, cb) => { + node + .stop() + .then(() => setImmediate(() => cb())) + .catch(err => setImmediate(() => cb(err))) + }, callback) } return { setup, teardown } From 3b9bf02b606ed07d752cf9e6d930c4a3679aedf1 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 11:19:43 +0100 Subject: [PATCH 29/49] chore: enable more --- test/interface.spec.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/interface.spec.js b/test/interface.spec.js index 7e1897747..7d63fb0e8 100644 --- a/test/interface.spec.js +++ b/test/interface.spec.js @@ -81,6 +81,7 @@ describe('interface-ipfs-core tests', () => { }) tests.dht(defaultCommonFactory, { + only: true, skip: [ // dht.findpeer { @@ -187,11 +188,7 @@ describe('interface-ipfs-core tests', () => { }) tests.miscellaneous(defaultCommonFactory, { - only: [ - { name: 'should get the node ID (promised)' }, - { name: 'should get the node version' }, - { name: 'should resolve an IPFS hash' } - ], + only: true, skip: [ // stop { From f5a9bb6b7b6e3b7ac1ffcd843e334683eb710058 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 13:58:49 +0100 Subject: [PATCH 30/49] chore: remove clg --- test/utils/interface-common-factory.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/utils/interface-common-factory.js b/test/utils/interface-common-factory.js index 48fece6df..aa01fe7a8 100644 --- a/test/utils/interface-common-factory.js +++ b/test/utils/interface-common-factory.js @@ -28,8 +28,6 @@ function createFactory (options) { .then((ipfsd) => { nodes.push(ipfsd) console.log('TCL: spawnNode -> ipfsd', ipfsd._apiAddr.toString()) - console.log('TCL: spawnNode -> ipfsd', ipfsd.initialized) - console.log('TCL: spawnNode -> ipfsd', ipfsd.started) setImmediate(() => cb(null, ipfsd.api)) }) From 858453b4a22ff8bbb2b0f7e8cb05ef1620167b7a Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 15:46:20 +0100 Subject: [PATCH 31/49] chore: dag --- test/interface.spec.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/interface.spec.js b/test/interface.spec.js index 7d63fb0e8..5b7e59091 100644 --- a/test/interface.spec.js +++ b/test/interface.spec.js @@ -54,6 +54,8 @@ describe('interface-ipfs-core tests', () => { }) tests.dag(defaultCommonFactory, { + only: true, + skip: [ // dag.tree { @@ -81,7 +83,6 @@ describe('interface-ipfs-core tests', () => { }) tests.dht(defaultCommonFactory, { - only: true, skip: [ // dht.findpeer { From 40743073528c8ec20737a7783eee5fae6790b4f6 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 15:55:37 +0100 Subject: [PATCH 32/49] chore: add more --- test/interface.spec.js | 43 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/test/interface.spec.js b/test/interface.spec.js index 5b7e59091..f8ae40fb5 100644 --- a/test/interface.spec.js +++ b/test/interface.spec.js @@ -7,7 +7,7 @@ const CommonFactory = require('./utils/interface-common-factory') const ipfsClient = require('../src') const isWindows = process.platform && process.platform === 'win32' -describe('interface-ipfs-core tests', () => { +describe.only('interface-ipfs-core tests', () => { const defaultCommonFactory = CommonFactory.create() tests.bitswap(defaultCommonFactory, { @@ -54,8 +54,6 @@ describe('interface-ipfs-core tests', () => { }) tests.dag(defaultCommonFactory, { - only: true, - skip: [ // dag.tree { @@ -82,25 +80,25 @@ describe('interface-ipfs-core tests', () => { ] }) - tests.dht(defaultCommonFactory, { - skip: [ - // dht.findpeer - { - name: 'should fail to find other peer if peer does not exist', - reason: 'FIXME checking what is exactly go-ipfs returning https://github.com/ipfs/go-ipfs/issues/3862#issuecomment-294168090' - }, - // dht.findprovs - { - name: 'should take options to override timeout config', - reason: 'FIXME go-ipfs does not support a timeout option' - }, - // dht.get - { - name: 'should get a value after it was put on another node', - reason: 'FIXME go-ipfs errors with Error: key was not found (type 6) https://github.com/ipfs/go-ipfs/issues/3862' - } - ] - }) + // tests.dht(defaultCommonFactory, { + // skip: [ + // // dht.findpeer + // { + // name: 'should fail to find other peer if peer does not exist', + // reason: 'FIXME checking what is exactly go-ipfs returning https://github.com/ipfs/go-ipfs/issues/3862#issuecomment-294168090' + // }, + // // dht.findprovs + // { + // name: 'should take options to override timeout config', + // reason: 'FIXME go-ipfs does not support a timeout option' + // }, + // // dht.get + // { + // name: 'should get a value after it was put on another node', + // reason: 'FIXME go-ipfs errors with Error: key was not found (type 6) https://github.com/ipfs/go-ipfs/issues/3862' + // } + // ] + // }) tests.filesRegular(defaultCommonFactory, { skip: [ @@ -189,7 +187,6 @@ describe('interface-ipfs-core tests', () => { }) tests.miscellaneous(defaultCommonFactory, { - only: true, skip: [ // stop { From 948b8f83c6be4e897b84238e18ddb70720d5d6e8 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 16:23:50 +0100 Subject: [PATCH 33/49] chore: only swarm --- test/interface.spec.js | 70 +++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 45 deletions(-) diff --git a/test/interface.spec.js b/test/interface.spec.js index f8ae40fb5..1cf74665d 100644 --- a/test/interface.spec.js +++ b/test/interface.spec.js @@ -80,25 +80,25 @@ describe.only('interface-ipfs-core tests', () => { ] }) - // tests.dht(defaultCommonFactory, { - // skip: [ - // // dht.findpeer - // { - // name: 'should fail to find other peer if peer does not exist', - // reason: 'FIXME checking what is exactly go-ipfs returning https://github.com/ipfs/go-ipfs/issues/3862#issuecomment-294168090' - // }, - // // dht.findprovs - // { - // name: 'should take options to override timeout config', - // reason: 'FIXME go-ipfs does not support a timeout option' - // }, - // // dht.get - // { - // name: 'should get a value after it was put on another node', - // reason: 'FIXME go-ipfs errors with Error: key was not found (type 6) https://github.com/ipfs/go-ipfs/issues/3862' - // } - // ] - // }) + tests.dht(defaultCommonFactory, { + skip: [ + // dht.findpeer + { + name: 'should fail to find other peer if peer does not exist', + reason: 'FIXME checking what is exactly go-ipfs returning https://github.com/ipfs/go-ipfs/issues/3862#issuecomment-294168090' + }, + // dht.findprovs + { + name: 'should take options to override timeout config', + reason: 'FIXME go-ipfs does not support a timeout option' + }, + // dht.get + { + name: 'should get a value after it was put on another node', + reason: 'FIXME go-ipfs errors with Error: key was not found (type 6) https://github.com/ipfs/go-ipfs/issues/3862' + } + ] + }) tests.filesRegular(defaultCommonFactory, { skip: [ @@ -267,31 +267,11 @@ describe.only('interface-ipfs-core tests', () => { tests.stats(defaultCommonFactory) - tests.swarm(CommonFactory.create({ - createSetup ({ ipfsFactory, nodes }) { - return callback => { - callback(null, { - spawnNode (repoPath, config, cb) { - if (typeof repoPath === 'function') { - cb = repoPath - repoPath = undefined - } - - if (typeof config === 'function') { - cb = config - config = undefined - } - - const spawnOptions = { repoPath, config, initOptions: { bits: 1024, profile: 'test' } } - - ipfsFactory.spawn(spawnOptions) - .then(ipfsd => { - nodes.push(ipfsd) - cb(null, ipfsClient(ipfsd.apiAddr)) - }, cb) - } - }) + tests.swarm(defaultCommonFactory, { + only: [ + { + name: 'should connect to a peer (promised)' } - } - })) + ] + }) }) From 72907ac3b771d09825881ea5ba6a8b941c211a95 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 16:54:12 +0100 Subject: [PATCH 34/49] chore: new setup --- package.json | 1 + test/interface.spec.js | 5 ++++- test/utils/interface-common-factory.js | 30 ++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 21826ddcc..c94c10c28 100644 --- a/package.json +++ b/package.json @@ -77,6 +77,7 @@ "ky": "^0.13.0", "ky-universal": "^0.3.0", "lru-cache": "^5.1.1", + "merge-options": "^1.0.1", "multiaddr": "^7.1.0", "multibase": "~0.6.0", "multicodec": "~0.5.1", diff --git a/test/interface.spec.js b/test/interface.spec.js index 1cf74665d..ee949c606 100644 --- a/test/interface.spec.js +++ b/test/interface.spec.js @@ -267,10 +267,13 @@ describe.only('interface-ipfs-core tests', () => { tests.stats(defaultCommonFactory) - tests.swarm(defaultCommonFactory, { + tests.swarm(CommonFactory.create2(), { only: [ { name: 'should connect to a peer (promised)' + }, + { + name: 'should connect to a peer' } ] }) diff --git a/test/utils/interface-common-factory.js b/test/utils/interface-common-factory.js index aa01fe7a8..dc1ca0c1c 100644 --- a/test/utils/interface-common-factory.js +++ b/test/utils/interface-common-factory.js @@ -4,6 +4,7 @@ const each = require('async/each') const IPFSFactory = require('ipfsd-ctl') const ipfsClient = require('../../src') +const merge = require('merge-options') function createFactory (options) { options = options || {} @@ -56,3 +57,32 @@ function createFactory (options) { } exports.create = createFactory + +function create2 () { + return () => { + const nodes = [] + const setup = async (factoryOptions = {}, spawnOptions) => { + const ipfsFactory = IPFSFactory.create(merge({ IpfsClient: ipfsClient }, factoryOptions)) + const node = await ipfsFactory.spawn(merge( + { initOptions: { profile: 'test' } }, + spawnOptions + )) + 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 + } + } +} + +exports.create2 = create2 From 795eabff8695633cb26eb3d20f80a6769ce6064e Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 16:58:01 +0100 Subject: [PATCH 35/49] chore: fix dep --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c94c10c28..784492b55 100644 --- a/package.json +++ b/package.json @@ -107,7 +107,7 @@ "cross-env": "^5.2.1", "dirty-chai": "^2.0.1", "go-ipfs-dep": "^0.4.22", - "interface-ipfs-core": "^0.113.1", + "interface-ipfs-core": "github:ipfs/interface-ipfs-core#fix/fix-electron", "ipfsd-ctl": "github:ipfs/js-ipfsd-ctl#fix/fix-electron", "nock": "^11.3.2", "stream-equal": "^1.1.1" From 86285162e370fc7d5849820a77158c99c7a30c4a Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 17:06:28 +0100 Subject: [PATCH 36/49] chore: debug --- test/utils/interface-common-factory.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/utils/interface-common-factory.js b/test/utils/interface-common-factory.js index dc1ca0c1c..bb8ebe11c 100644 --- a/test/utils/interface-common-factory.js +++ b/test/utils/interface-common-factory.js @@ -72,6 +72,7 @@ function create2 () { const id = await node.api.id() node.api.peerId = id + console.log('spawned', id.id) return node.api } From ae5150a921163e4297f3913c84cb1ca42dd1ed32 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 17:36:23 +0100 Subject: [PATCH 37/49] fix: support create options --- package.json | 1 + test/interface.spec.js | 9 +-------- test/utils/interface-common-factory.js | 11 ++++++++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 784492b55..9e90e03a8 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "cids": "~0.7.1", "concat-stream": "github:hugomrdias/concat-stream#feat/smaller", "debug": "^4.1.0", + "delay": "^4.3.0", "detect-node": "^2.0.4", "end-of-stream": "^1.4.1", "err-code": "^2.0.0", diff --git a/test/interface.spec.js b/test/interface.spec.js index ee949c606..dc5ea7080 100644 --- a/test/interface.spec.js +++ b/test/interface.spec.js @@ -268,13 +268,6 @@ describe.only('interface-ipfs-core tests', () => { tests.stats(defaultCommonFactory) tests.swarm(CommonFactory.create2(), { - only: [ - { - name: 'should connect to a peer (promised)' - }, - { - name: 'should connect to a peer' - } - ] + only: true }) }) diff --git a/test/utils/interface-common-factory.js b/test/utils/interface-common-factory.js index bb8ebe11c..eaf800916 100644 --- a/test/utils/interface-common-factory.js +++ b/test/utils/interface-common-factory.js @@ -58,14 +58,19 @@ function createFactory (options) { exports.create = createFactory -function create2 () { +function create2 (createFactoryOptions, createSpawnOptions) { return () => { const nodes = [] const setup = async (factoryOptions = {}, spawnOptions) => { - const ipfsFactory = IPFSFactory.create(merge({ IpfsClient: ipfsClient }, factoryOptions)) + const ipfsFactory = IPFSFactory.create(merge( + { IpfsClient: ipfsClient }, + factoryOptions, + createFactoryOptions + )) const node = await ipfsFactory.spawn(merge( { initOptions: { profile: 'test' } }, - spawnOptions + spawnOptions, + createSpawnOptions )) nodes.push(node) From 07e026992a6064e0ac10b7fd34b45bca4bf3677e Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 18:11:49 +0100 Subject: [PATCH 38/49] chore: increade timeout --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e4d8e2894..f2ee871ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,7 +47,7 @@ jobs: - stage: test name: electron-renderer script: - - xvfb-run npx aegir test -t electron-renderer + - xvfb-run npx aegir test -t electron-renderer --timeout 80000 notifications: email: false From 0b4f9172c2eed95df649b18a5e473238e08308d5 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 18:18:35 +0100 Subject: [PATCH 39/49] chore: increade timeout 2 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f2ee871ee..c80a5082e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,7 +47,7 @@ jobs: - stage: test name: electron-renderer script: - - xvfb-run npx aegir test -t electron-renderer --timeout 80000 + - xvfb-run npx aegir test -t electron-renderer -- --timeout 80000 notifications: email: false From f1a719df585e05e4efb4af9985f63dc93ef9a477 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 18:39:50 +0100 Subject: [PATCH 40/49] chore: change aegir --- .travis.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index c80a5082e..e4d8e2894 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,7 +47,7 @@ jobs: - stage: test name: electron-renderer script: - - xvfb-run npx aegir test -t electron-renderer -- --timeout 80000 + - xvfb-run npx aegir test -t electron-renderer notifications: email: false diff --git a/package.json b/package.json index 9e90e03a8..fe0930fcc 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,7 @@ "through2": "^3.0.1" }, "devDependencies": { - "aegir": "^20.1.0", + "aegir": "ipfs/aegir#chore/update-deps2", "browser-process-platform": "~0.1.1", "chai": "^4.2.0", "chai-as-promised": "^7.1.1", From 73389c09c8f6c9d134d2ece32d181dc69a8f9b43 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 18:53:18 +0100 Subject: [PATCH 41/49] chore: change os --- .aegir.js | 1 - .travis.yml | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.aegir.js b/.aegir.js index 60ca266da..9a75337d1 100644 --- a/.aegir.js +++ b/.aegir.js @@ -35,7 +35,6 @@ module.exports = { return Promise.all([ server.start(), echoServerStart() - ]) }, post: () => { diff --git a/.travis.yml b/.travis.yml index e4d8e2894..39b82f87b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,8 +46,9 @@ jobs: - stage: test name: electron-renderer + os: osx script: - - xvfb-run npx aegir test -t electron-renderer + - npx aegir test -t electron-renderer notifications: email: false From 92d74ed97d3c8124698c6000803c099392289b29 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 19:26:57 +0100 Subject: [PATCH 42/49] chore: test all --- .travis.yml | 19 +++++++++---------- package.json | 4 ++-- src/dht/findpeer.js | 2 +- test/interface.spec.js | 7 ++----- test/utils/interface-common-factory.js | 5 ----- 5 files changed, 14 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index 39b82f87b..c391721f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,8 @@ language: node_js -# cache: npm -cache: false +cache: npm stages: - # - check + - check - test - cov @@ -21,11 +20,11 @@ after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codeco jobs: include: - # - stage: check - # script: - # - npx aegir build --bundlesize - # - npx aegir dep-check - # - npm run lint + - stage: check + script: + - npx aegir build --bundlesize + - npx aegir dep-check + - npm run lint - stage: test name: chrome @@ -42,13 +41,13 @@ jobs: - stage: test name: electron-main script: - - xvfb-run npx aegir test -t electron-main -- --bail + - xvfb-run npx aegir test -t electron-main --bail - stage: test name: electron-renderer os: osx script: - - npx aegir test -t electron-renderer + - npx aegir test -t electron-renderer --bail notifications: email: false diff --git a/package.json b/package.json index fe0930fcc..14eeed5a3 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,7 @@ "through2": "^3.0.1" }, "devDependencies": { - "aegir": "ipfs/aegir#chore/update-deps2", + "aegir": "ipfs/aegir#master", "browser-process-platform": "~0.1.1", "chai": "^4.2.0", "chai-as-promised": "^7.1.1", @@ -109,7 +109,7 @@ "dirty-chai": "^2.0.1", "go-ipfs-dep": "^0.4.22", "interface-ipfs-core": "github:ipfs/interface-ipfs-core#fix/fix-electron", - "ipfsd-ctl": "github:ipfs/js-ipfsd-ctl#fix/fix-electron", + "ipfsd-ctl": "^0.46.2", "nock": "^11.3.2", "stream-equal": "^1.1.1" }, diff --git a/src/dht/findpeer.js b/src/dht/findpeer.js index 046664bda..8bcc80fb5 100644 --- a/src/dht/findpeer.js +++ b/src/dht/findpeer.js @@ -32,7 +32,7 @@ module.exports = (send) => { // 2 = FinalPeer // https://github.com/libp2p/go-libp2p-core/blob/6e566d10f4a5447317a66d64c7459954b969bdab/routing/query.go#L18 if (!res || res.Type !== 2) { - const errMsg = `key was not found (type 4)` + const errMsg = 'key was not found (type 4)' return callback(errcode(new Error(errMsg), 'ERR_KEY_TYPE_4_NOT_FOUND')) } diff --git a/test/interface.spec.js b/test/interface.spec.js index dc5ea7080..d993da8b3 100644 --- a/test/interface.spec.js +++ b/test/interface.spec.js @@ -4,10 +4,9 @@ const tests = require('interface-ipfs-core') const isNode = require('detect-node') const CommonFactory = require('./utils/interface-common-factory') -const ipfsClient = require('../src') const isWindows = process.platform && process.platform === 'win32' -describe.only('interface-ipfs-core tests', () => { +describe('interface-ipfs-core tests', () => { const defaultCommonFactory = CommonFactory.create() tests.bitswap(defaultCommonFactory, { @@ -267,7 +266,5 @@ describe.only('interface-ipfs-core tests', () => { tests.stats(defaultCommonFactory) - tests.swarm(CommonFactory.create2(), { - only: true - }) + tests.swarm(CommonFactory.create2()) }) diff --git a/test/utils/interface-common-factory.js b/test/utils/interface-common-factory.js index eaf800916..0ff100fa0 100644 --- a/test/utils/interface-common-factory.js +++ b/test/utils/interface-common-factory.js @@ -24,16 +24,12 @@ function createFactory (options) { setup = (callback) => { callback(null, { spawnNode (cb) { - console.log('TCL: spawnNode -> spawn') ipfsFactory.spawn(options.spawnOptions) .then((ipfsd) => { nodes.push(ipfsd) - console.log('TCL: spawnNode -> ipfsd', ipfsd._apiAddr.toString()) - setImmediate(() => cb(null, ipfsd.api)) }) .catch(err => { - console.log('TCL: spawnNode -> err', err) setImmediate(() => cb(err)) }) } @@ -77,7 +73,6 @@ function create2 (createFactoryOptions, createSpawnOptions) { const id = await node.api.id() node.api.peerId = id - console.log('spawned', id.id) return node.api } From 0ab555d49165b42dc124db53c7db6612ec7dbb60 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 20:44:50 +0100 Subject: [PATCH 43/49] chore: change os for main --- .travis.yml | 1 + test/utils/interface-common-factory.js | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index c391721f4..85ca37c32 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,6 +40,7 @@ jobs: - stage: test name: electron-main + os: osx script: - xvfb-run npx aegir test -t electron-main --bail diff --git a/test/utils/interface-common-factory.js b/test/utils/interface-common-factory.js index 0ff100fa0..4a47fda42 100644 --- a/test/utils/interface-common-factory.js +++ b/test/utils/interface-common-factory.js @@ -52,9 +52,7 @@ function createFactory (options) { } } -exports.create = createFactory - -function create2 (createFactoryOptions, createSpawnOptions) { +function createAsync (createFactoryOptions, createSpawnOptions) { return () => { const nodes = [] const setup = async (factoryOptions = {}, spawnOptions) => { @@ -85,5 +83,7 @@ function create2 (createFactoryOptions, createSpawnOptions) { } } } - -exports.create2 = create2 +module.exports = { + createAsync, + create: createFactory +} From 0504d111d0c4b0d80315b12bcfd260d3798085b4 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 20:45:35 +0100 Subject: [PATCH 44/49] chore: remove xvfb --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 85ca37c32..f435392ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,7 +42,7 @@ jobs: name: electron-main os: osx script: - - xvfb-run npx aegir test -t electron-main --bail + - npx aegir test -t electron-main --bail - stage: test name: electron-renderer From 8362a60175c1b6bed0c76b7413683e5a68d543d6 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 20:50:57 +0100 Subject: [PATCH 45/49] chore: fix fn name --- test/interface.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/interface.spec.js b/test/interface.spec.js index d993da8b3..571a615b7 100644 --- a/test/interface.spec.js +++ b/test/interface.spec.js @@ -266,5 +266,5 @@ describe('interface-ipfs-core tests', () => { tests.stats(defaultCommonFactory) - tests.swarm(CommonFactory.create2()) + tests.swarm(CommonFactory.createAsync()) }) From 966e1427c6b23521a2a64e5ca802176ca7be46eb Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Sun, 15 Sep 2019 22:34:01 +0100 Subject: [PATCH 46/49] chore: delete comments --- test/interface.spec.js | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/test/interface.spec.js b/test/interface.spec.js index 571a615b7..e3c8ffb19 100644 --- a/test/interface.spec.js +++ b/test/interface.spec.js @@ -101,25 +101,6 @@ describe('interface-ipfs-core tests', () => { tests.filesRegular(defaultCommonFactory, { skip: [ - // // .add - // isNode ? null : { - // name: 'should add a nested directory as array of tupples', - // reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' - // }, - // isNode ? null : { - // name: 'should add a nested directory as array of tupples with progress', - // reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' - // }, - // // .addPullStream - // isNode ? null : { - // name: 'should add pull stream of valid files and dirs', - // reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' - // }, - // // .addReadableStream - // isNode ? null : { - // name: 'should add readable stream of valid files and dirs', - // reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' - // }, // .addFromFs isNode ? null : { name: 'addFromFs', @@ -138,26 +119,6 @@ describe('interface-ipfs-core tests', () => { name: 'should export a chunk of a file in a Readable Stream', reason: 'TODO not implemented in go-ipfs yet' } - // // .get - // isNode ? null : { - // name: 'should get a directory', - // reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' - // }, - // // .ls - // isNode ? null : { - // name: 'should ls with a base58 encoded CID', - // reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' - // }, - // // .lsPullStream - // isNode ? null : { - // name: 'should pull stream ls with a base58 encoded CID', - // reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' - // }, - // // .lsReadableStream - // isNode ? null : { - // name: 'should readable stream ls with a base58 encoded CID', - // reason: 'FIXME https://github.com/ipfs/js-ipfs-http-client/issues/339' - // } ] }) From 30bbaa443b692abde2727ca53b51d6b587bf4f76 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Mon, 16 Sep 2019 12:44:34 +0100 Subject: [PATCH 47/49] chore: upgrade aegir --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 14eeed5a3..2476c4104 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,7 @@ "through2": "^3.0.1" }, "devDependencies": { - "aegir": "ipfs/aegir#master", + "aegir": "^20.2.0", "browser-process-platform": "~0.1.1", "chai": "^4.2.0", "chai-as-promised": "^7.1.1", From 8819e6c3b89db50b16226a7d0a1e1d74fee2676b Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Mon, 16 Sep 2019 15:03:35 +0100 Subject: [PATCH 48/49] chore: update interface-core --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2476c4104..b3c656c1c 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,7 @@ "cross-env": "^5.2.1", "dirty-chai": "^2.0.1", "go-ipfs-dep": "^0.4.22", - "interface-ipfs-core": "github:ipfs/interface-ipfs-core#fix/fix-electron", + "interface-ipfs-core": "~0.114.0", "ipfsd-ctl": "^0.46.2", "nock": "^11.3.2", "stream-equal": "^1.1.1" From 651d0d9a918f6be280e00be61c7d381adaa60740 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Mon, 16 Sep 2019 15:42:39 +0100 Subject: [PATCH 49/49] chore: add link to upstream ky fix --- src/add/form-data.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/add/form-data.js b/src/add/form-data.js index 7e56d5605..96d55f672 100644 --- a/src/add/form-data.js +++ b/src/add/form-data.js @@ -43,6 +43,7 @@ exports.toFormData = async input => { } // TODO remove this when upstream fix for ky-universal is merged +// https://github.com/sindresorhus/ky-universal/issues/9 // also this should only be necessary when nodeIntegration is false in electron renderer if (isElectronRenderer) { exports.toFormData = require('./form-data.browser').toFormData