diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 18284e69dc..0000000000 --- a/.npmignore +++ /dev/null @@ -1,36 +0,0 @@ -**/node_modules/ -**/*.log -test/repo-tests* - -# Logs -logs -*.log - -coverage - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -.nyc_output - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# node-waf configuration -.lock-wscript - -build - -# Dependency directory -# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git -node_modules - -test -examples diff --git a/.travis.yml b/.travis.yml index 97dd6528ef..19ece97bfc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,13 +11,14 @@ stages: node_js: - '10' + - '12' os: - linux - osx - windows -script: npx nyc -s npm run test:node -- --bail +script: npx nyc -s npm run test:node --timeout=10000 -- --bail after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov jobs: @@ -43,5 +44,15 @@ jobs: - npx aegir test -t browser -- --browsers FirefoxHeadless - npx aegir test -t webworker -- --browsers FirefoxHeadless + - stage: test + name: electron-main + script: + - xvfb-run npx aegir test -t electron-main -- --bail + + - stage: test + name: electron-renderer + script: + - xvfb-run npx aegir test -t electron-renderer -- --bail + notifications: email: false diff --git a/examples/circuit-relaying/package.json b/examples/circuit-relaying/package.json index 96935ec4ef..fb04c66377 100644 --- a/examples/circuit-relaying/package.json +++ b/examples/circuit-relaying/package.json @@ -18,7 +18,7 @@ "ipfs-pubsub-room": "^1.4.0" }, "devDependencies": { - "aegir": "^18.0.3", + "aegir": "^19.0.3", "ipfs-css": "~0.12.0", "parcel-bundler": "^1.6.2", "tachyons": "^4.9.1" diff --git a/examples/circuit-relaying/src/app.js b/examples/circuit-relaying/src/app.js index 4f724e9a63..e6630e4773 100644 --- a/examples/circuit-relaying/src/app.js +++ b/examples/circuit-relaying/src/app.js @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ 'use strict' const IPFS = require('ipfs') diff --git a/examples/circuit-relaying/src/helpers.js b/examples/circuit-relaying/src/helpers.js index 57020a770f..26a277ef2a 100644 --- a/examples/circuit-relaying/src/helpers.js +++ b/examples/circuit-relaying/src/helpers.js @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ 'use strict' const Room = require('ipfs-pubsub-room') diff --git a/package.json b/package.json index ac8b1167cb..60225e8303 100644 --- a/package.json +++ b/package.json @@ -2,10 +2,17 @@ "name": "ipfs", "version": "0.36.3", "description": "JavaScript implementation of the IPFS specification", + "keywords": [ + "IPFS" + ], + "homepage": "https://js.ipfs.io", + "bugs": "https://github.com/ipfs/js-ipfs/issues", + "license": "MIT", "leadMaintainer": "Alan Shaw ", - "bin": { - "jsipfs": "src/cli/bin.js" - }, + "files": [ + "src", + "dist" + ], "main": "src/core/index.js", "browser": { "./src/core/components/init-assets.js": false, @@ -23,23 +30,23 @@ "browser-all-ipld-formats": { "./src/core/runtime/ipld-browser.js": "./src/core/runtime/ipld-browser-all.js" }, - "engines": { - "node": ">=10.0.0", - "npm": ">=6.0.0" + "bin": { + "jsipfs": "src/cli/bin.js" }, + "repository": "github:ipfs/js-ipfs", "scripts": { "lint": "aegir lint", "build": "aegir build", - "test": "aegir test -t node -t browser -t webworker --no-cors --timeout=10000", - "test:node": "aegir test -t node --timeout=10000", - "test:browser": "aegir test -t browser --no-cors --timeout=10000", - "test:webworker": "aegir test -t webworker --no-cors --timeout=10000", - "test:node:core": "aegir test -t node -f test/core/**/*.js --timeout=10000", - "test:node:http": "aegir test -t node -f test/http-api/index.js --timeout=10000", - "test:node:gateway": "aegir test -t node -f test/gateway/index.js --timeout=10000", - "test:node:cli": "aegir test -t node -f test/cli/index.js --timeout=10000", - "test:node:interface": "aegir test -t node -f test/core/interface.spec.js --timeout=10000", - "test:bootstrapers": "IPFS_TEST=bootstrapers aegir test -t browser -f test/bootstrapers.js --timeout=10000", + "test": "aegir test", + "test:node": "aegir test -t node", + "test:browser": "aegir test -t browser", + "test:webworker": "aegir test -t webworker", + "test:node:core": "aegir test -t node -f test/core/**/*.js", + "test:node:http": "aegir test -t node -f test/http-api/index.js", + "test:node:gateway": "aegir test -t node -f test/gateway/index.js", + "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", "benchmark": "echo \"Error: no benchmarks yet\" && exit 1", "benchmark:node": "echo \"Error: no benchmarks yet\" && exit 1", "benchmark:node:core": "echo \"Error: no benchmarks yet\" && exit 1", @@ -49,47 +56,12 @@ "release-minor": "aegir release --type minor -t node -t browser", "release-major": "aegir release --type major -t node -t browser" }, - "repository": { - "type": "git", - "url": "git+https://github.com/ipfs/js-ipfs.git" - }, - "keywords": [ - "IPFS" - ], - "license": "MIT", - "bugs": { - "url": "https://github.com/ipfs/js-ipfs/issues" - }, - "homepage": "https://github.com/ipfs/js-ipfs#readme", - "pre-push": [ - "lint" - ], - "devDependencies": { - "aegir": "^18.1.0", - "base64url": "^3.0.1", - "chai": "^4.2.0", - "delay": "^4.1.0", - "detect-node": "^2.0.4", - "dir-compare": "^1.4.0", - "dirty-chai": "^2.0.1", - "execa": "^1.0.0", - "form-data": "^2.3.3", - "hat": "0.0.3", - "interface-ipfs-core": "~0.104.0", - "ipfsd-ctl": "~0.42.0", - "libp2p-websocket-star": "~0.10.2", - "ncp": "^2.0.0", - "qs": "^6.5.2", - "rimraf": "^2.6.2", - "sinon": "^7.3.1", - "stream-to-promise": "^2.2.0" - }, "dependencies": { "@hapi/ammo": "^3.1.0", "@hapi/hapi": "^18.3.1", "@hapi/joi": "^15.0.1", "async": "^2.6.1", - "async-iterator-all": "0.0.2", + "async-iterator-all": "^1.0.0", "async-iterator-to-pull-stream": "^1.1.0", "async-iterator-to-stream": "^1.1.0", "base32.js": "~0.1.0", @@ -200,10 +172,34 @@ "yargs": "^13.2.4", "yargs-promise": "^1.1.0" }, + "devDependencies": { + "aegir": "^19.0.3", + "base64url": "^3.0.1", + "chai": "^4.2.0", + "delay": "^4.1.0", + "detect-node": "^2.0.4", + "dir-compare": "^1.4.0", + "dirty-chai": "^2.0.1", + "execa": "^1.0.0", + "form-data": "^2.3.3", + "hat": "0.0.3", + "interface-ipfs-core": "~0.104.0", + "ipfsd-ctl": "~0.42.0", + "libp2p-websocket-star": "~0.10.2", + "ncp": "^2.0.0", + "qs": "^6.5.2", + "rimraf": "^2.6.2", + "sinon": "^7.3.1", + "stream-to-promise": "^2.2.0" + }, "optionalDependencies": { "prom-client": "^11.1.3", "prometheus-gc-stats": "~0.6.0" }, + "engines": { + "node": ">=10.0.0", + "npm": ">=6.0.0" + }, "contributors": [ "0xflotus <0xflotus@gmail.com>", "A_A <21040751+Otto-AA@users.noreply.github.com>", diff --git a/src/cli/bin.js b/src/cli/bin.js index a9c7eede9f..ec3b8c347d 100755 --- a/src/cli/bin.js +++ b/src/cli/bin.js @@ -1,5 +1,6 @@ #! /usr/bin/env node +/* eslint-disable no-console */ 'use strict' process.on('uncaughtException', (err) => { @@ -31,7 +32,7 @@ const debug = require('debug')('ipfs:cli') const parser = require('./parser') const commandAlias = require('./command-alias') -async function main (args) { +function main (args) { const oneWeek = 1000 * 60 * 60 * 24 * 7 updateNotifier({ pkg, updateCheckInterval: oneWeek }).notify() diff --git a/src/http/api/resources/bootstrap.js b/src/http/api/resources/bootstrap.js index f7f3a44736..6721b9d420 100644 --- a/src/http/api/resources/bootstrap.js +++ b/src/http/api/resources/bootstrap.js @@ -25,8 +25,6 @@ exports.add = { } } - console.log('parseArgs', { default: def }) - return { default: def } }, async handler (request, h) { diff --git a/src/http/api/resources/stats.js b/src/http/api/resources/stats.js index 616b678154..f785ff9bfe 100644 --- a/src/http/api/resources/stats.js +++ b/src/http/api/resources/stats.js @@ -15,7 +15,7 @@ exports.bitswap = require('./bitswap').stat exports.repo = require('./repo').stat -exports.bw = async (request, h) => { +exports.bw = (request, h) => { const { ipfs } = request.server.app const options = { peer: request.query.peer, diff --git a/test/cli/daemon.js b/test/cli/daemon.js index c7639b21ab..882960d6e7 100644 --- a/test/cli/daemon.js +++ b/test/cli/daemon.js @@ -213,7 +213,8 @@ describe('daemon', () => { }) }) - it('should print version info', async () => { + it('should print version info', async function () { + this.timeout(100 * 1000) await ipfs('init') const out = await new Promise(resolve => { diff --git a/test/cli/object.js b/test/cli/object.js index efaaf6cc5e..7dd33ca09e 100644 --- a/test/cli/object.js +++ b/test/cli/object.js @@ -79,7 +79,8 @@ describe('object', () => runOnAndOff((thing) => { }) }) - it('should get and print CIDs encoded in specified base', () => { + it('should get and print CIDs encoded in specified base', function () { + this.timeout(15 * 1000) return ipfs(`add ${path.resolve(path.join(__dirname, '..'))}/fixtures/planets -r --cid-version=1`) .then(out => { const lines = out.trim().split('\n') diff --git a/test/core/create-node.spec.js b/test/core/create-node.spec.js index 4fdf708720..5d41eb980d 100644 --- a/test/core/create-node.spec.js +++ b/test/core/create-node.spec.js @@ -143,7 +143,9 @@ describe('create node', function () { }) ipfs.on('ready', () => { + // eslint-disable-next-line no-console expect(console.log.called).to.be.false() + // eslint-disable-next-line no-console console.log.restore() ipfs.stop(done) }) diff --git a/test/core/dag.spec.js b/test/core/dag.spec.js index c556ffb726..4b9cf089a2 100644 --- a/test/core/dag.spec.js +++ b/test/core/dag.spec.js @@ -10,12 +10,11 @@ chai.use(dirtyChai) const IPFSFactory = require('ipfsd-ctl') const IPFS = require('../../src/core') -describe('dag', () => { +describe('dag', function () { + this.timeout(10 * 1000) let ipfsd, ipfs before(function (done) { - this.timeout(20 * 1000) - const factory = IPFSFactory.create({ type: 'proc' }) factory.spawn({ @@ -30,7 +29,7 @@ describe('dag', () => { }) }) - after((done) => { + after(function (done) { if (ipfsd) { ipfsd.stop(done) } else { diff --git a/test/core/files.spec.js b/test/core/files.spec.js index 6570480006..0558e88419 100644 --- a/test/core/files.spec.js +++ b/test/core/files.spec.js @@ -11,12 +11,11 @@ const pull = require('pull-stream') const IPFSFactory = require('ipfsd-ctl') const IPFS = require('../../src/core') -describe('files', () => { +describe('files', function () { + this.timeout(10 * 1000) let ipfsd, ipfs before(function (done) { - this.timeout(20 * 1000) - const factory = IPFSFactory.create({ type: 'proc' }) factory.spawn({ diff --git a/test/core/libp2p.spec.js b/test/core/libp2p.spec.js index 99a4e4c154..c15173758e 100644 --- a/test/core/libp2p.spec.js +++ b/test/core/libp2p.spec.js @@ -74,6 +74,7 @@ describe('libp2p customization', function () { }, _peerInfo: peerInfo, _peerBook: peerBook, + // eslint-disable-next-line no-console _print: console.log, _options: { libp2p: (opts) => { @@ -123,6 +124,7 @@ describe('libp2p customization', function () { }, _peerInfo: peerInfo, _peerBook: peerBook, + // eslint-disable-next-line no-console _print: console.log } @@ -165,6 +167,7 @@ describe('libp2p customization', function () { }, _peerInfo: peerInfo, _peerBook: peerBook, + // eslint-disable-next-line no-console _print: console.log, _options: { config: { diff --git a/test/core/object.spec.js b/test/core/object.spec.js index 8719413d73..2cbbbd2ada 100644 --- a/test/core/object.spec.js +++ b/test/core/object.spec.js @@ -12,12 +12,11 @@ const auto = require('async/auto') const waterfall = require('async/waterfall') const IPFS = require('../../src/core') -describe('object', () => { +describe('object', function () { + this.timeout(10 * 1000) let ipfsd, ipfs before(function (done) { - this.timeout(50 * 1000) - const factory = IPFSFactory.create({ type: 'proc' }) factory.spawn({ diff --git a/test/core/pin.spec.js b/test/core/pin.spec.js index d48695579b..bd2126c7bb 100644 --- a/test/core/pin.spec.js +++ b/test/core/pin.spec.js @@ -10,12 +10,11 @@ chai.use(dirtyChai) const IPFSFactory = require('ipfsd-ctl') const IPFS = require('../../src/core') -describe('pin', () => { +describe('pin', function () { + this.timeout(10 * 1000) let ipfsd, ipfs before(function (done) { - this.timeout(20 * 1000) - const factory = IPFSFactory.create({ type: 'proc' }) factory.spawn({ diff --git a/test/core/stats.spec.js b/test/core/stats.spec.js index dc5f9b5e38..a89f9174c5 100644 --- a/test/core/stats.spec.js +++ b/test/core/stats.spec.js @@ -11,12 +11,11 @@ const pull = require('pull-stream') const IPFSFactory = require('ipfsd-ctl') const IPFS = require('../../src/core') -describe('stats', () => { +describe('stats', function () { + this.timeout(10 * 1000) let ipfsd, ipfs before(function (done) { - this.timeout(20 * 1000) - const factory = IPFSFactory.create({ type: 'proc' }) factory.spawn({ diff --git a/test/core/swarm.spec.js b/test/core/swarm.spec.js index a0b32372a4..fb35cfff33 100644 --- a/test/core/swarm.spec.js +++ b/test/core/swarm.spec.js @@ -10,12 +10,11 @@ chai.use(dirtyChai) const IPFSFactory = require('ipfsd-ctl') const IPFS = require('../../src/core') -describe('swarm', () => { +describe('swarm', function () { + this.timeout(10 * 1000) let ipfsd, ipfs before(function (done) { - this.timeout(20 * 1000) - const factory = IPFSFactory.create({ type: 'proc' }) factory.spawn({ diff --git a/test/http-api/inject/bitswap.js b/test/http-api/inject/bitswap.js index 303831884b..c8dc80ca55 100644 --- a/test/http-api/inject/bitswap.js +++ b/test/http-api/inject/bitswap.js @@ -15,7 +15,7 @@ module.exports = (http) => { api = http.api._httpApi._apiServers[0] }) - before(async function () { + before(function () { this.timeout(120 * 1000) // Add a CID to the wantlist diff --git a/test/utils/on-and-off.js b/test/utils/on-and-off.js index 840d7bbe8e..c9a0b03019 100644 --- a/test/utils/on-and-off.js +++ b/test/utils/on-and-off.js @@ -16,7 +16,8 @@ const df = DaemonFactory.create() const path = require('path') function off (tests) { - describe('daemon off (directly to core)', () => { + describe('daemon off (directly to core)', function () { + this.timeout(60 * 1000) let thing = {} let repoPath @@ -40,7 +41,8 @@ function off (tests) { } function on (tests) { - describe('daemon on (through http-api)', () => { + describe('daemon on (through http-api)', function () { + this.timeout(60 * 1000) let thing = {} let ipfsd