Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
fix: pull in preconfigured chai from interface tests
Browse files Browse the repository at this point in the history
This is to work around chaijs/chai#1298

Fundamentally we cannot pull in chai and add plugins to it without
being careful of the order of those plugins as it's a singleton.

All we're really interested in is the `expect` function to just get
the preconfigured one from the interface tests.
  • Loading branch information
achingbrain committed Oct 4, 2019
1 parent 1dca93d commit b373ce3
Show file tree
Hide file tree
Showing 79 changed files with 79 additions and 245 deletions.
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"ipfs-bitswap": "^0.26.0",
"ipfs-block": "~0.8.1",
"ipfs-block-service": "~0.16.0",
"ipfs-http-client": "^38.0.0",
"ipfs-http-client": "^38.0.1",
"ipfs-http-response": "~0.3.1",
"ipfs-mfs": "^0.13.0",
"ipfs-multipart": "^0.2.0",
Expand Down Expand Up @@ -195,16 +195,14 @@
"devDependencies": {
"aegir": "^20.3.1",
"base64url": "^3.0.1",
"chai": "^4.2.0",
"clear-module": "^4.0.0",
"delay": "^4.1.0",
"detect-node": "^2.0.4",
"dir-compare": "^1.7.3",
"dirty-chai": "^2.0.1",
"execa": "^2.0.4",
"form-data": "^2.5.1",
"hat": "0.0.3",
"interface-ipfs-core": "^0.115.1",
"interface-ipfs-core": "^0.115.3",
"ipfs-interop": "~0.1.0",
"ipfsd-ctl": "^0.47.2",
"libp2p-websocket-star": "~0.10.2",
Expand Down
2 changes: 1 addition & 1 deletion test/cli/bitswap.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const expect = require('chai').expect
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const runOn = require('../utils/on-and-off').on
const PeerId = require('peer-id')
const CID = require('cids')
Expand Down
2 changes: 1 addition & 1 deletion test/cli/block.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const expect = require('chai').expect
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const runOnAndOff = require('../utils/on-and-off')

describe('block', () => runOnAndOff((thing) => {
Expand Down
2 changes: 1 addition & 1 deletion test/cli/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint-env mocha */
'use strict'

const expect = require('chai').expect
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const runOnAndOff = require('../utils/on-and-off')

describe('bootstrap', () => runOnAndOff((thing) => {
Expand Down
2 changes: 1 addition & 1 deletion test/cli/commands.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const expect = require('chai').expect
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const runOnAndOff = require('../utils/on-and-off')

const commandCount = 95
Expand Down
5 changes: 1 addition & 4 deletions test/cli/config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
/* eslint-env mocha */
'use strict'

const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const fs = require('fs')
const path = require('path')
const runOnAndOff = require('../utils/on-and-off')
Expand Down
2 changes: 1 addition & 1 deletion test/cli/daemon.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const expect = require('chai').expect
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const clean = require('../utils/clean')
const ipfsCmd = require('../utils/ipfs-exec')
const isWindows = require('../utils/platforms').isWindows
Expand Down
2 changes: 1 addition & 1 deletion test/cli/dag.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const expect = require('chai').expect
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const runOnAndOff = require('../utils/on-and-off')
const path = require('path')

Expand Down
6 changes: 1 addition & 5 deletions test/cli/dht.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

'use strict'

const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)

const { expect } = require('interface-ipfs-core/src/utils/mocha')
const path = require('path')
const DaemonFactory = require('ipfsd-ctl')
const df = DaemonFactory.create({
Expand Down
2 changes: 1 addition & 1 deletion test/cli/dns.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const expect = require('chai').expect
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const runOnAndOff = require('../utils/on-and-off')
const isIPFS = require('is-ipfs')

Expand Down
2 changes: 1 addition & 1 deletion test/cli/file.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const expect = require('chai').expect
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const runOnAndOff = require('../utils/on-and-off')
const file = 'QmR56UJmAaZLXLdTT1ALrE9vVqV8soUEekm9BMd4FnuYqV'
const dir = 'Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z'
Expand Down
2 changes: 1 addition & 1 deletion test/cli/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

const fs = require('fs')
const os = require('os')
const expect = require('chai').expect
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const path = require('path')
const hat = require('hat')
const compareDir = require('dir-compare').compareSync
Expand Down
2 changes: 1 addition & 1 deletion test/cli/general.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const expect = require('chai').expect
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const runOnAndOff = require('../utils/on-and-off')

describe('general cli options', () => runOnAndOff.off((thing) => {
Expand Down
5 changes: 1 addition & 4 deletions test/cli/id.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
'use strict'

const sinon = require('sinon')
const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const YargsPromise = require('yargs-promise')
const clearModule = require('clear-module')
chai.use(dirtyChai)

describe('id', () => {
let cli
Expand Down
2 changes: 1 addition & 1 deletion test/cli/init.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const expect = require('chai').expect
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const path = require('path')
const fs = require('fs')
const clean = require('../utils/clean')
Expand Down
2 changes: 1 addition & 1 deletion test/cli/key.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const expect = require('chai').expect
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const runOnAndOff = require('../utils/on-and-off')
const hat = require('hat')

Expand Down
2 changes: 1 addition & 1 deletion test/cli/ls.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const expect = require('chai').expect
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const runOnAndOff = require('../utils/on-and-off')
const delay = require('delay')

Expand Down
5 changes: 1 addition & 4 deletions test/cli/name-pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
/* eslint-env mocha */
'use strict'

const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const path = require('path')
const ipfsExec = require('../utils/ipfs-exec')

Expand Down
2 changes: 1 addition & 1 deletion test/cli/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'use strict'

const hat = require('hat')
const expect = require('chai').expect
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const runOnAndOff = require('../utils/on-and-off')
const UnixFs = require('ipfs-unixfs')
const path = require('path')
Expand Down
5 changes: 1 addition & 4 deletions test/cli/parser.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
/* eslint-env mocha */
'use strict'

const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const parser = require('../../src/cli/parser')
const YargsPromise = require('yargs-promise')

Expand Down
2 changes: 1 addition & 1 deletion test/cli/pin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint max-nested-callbacks: ["error", 8] */
'use strict'

const expect = require('chai').expect
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const CID = require('cids')
const runOnAndOff = require('../utils/on-and-off')
const path = require('path')
Expand Down
5 changes: 1 addition & 4 deletions test/cli/ping.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@
/* eslint-env mocha */
'use strict'

const chai = require('chai')
const dirtyChai = require('dirty-chai')
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const DaemonFactory = require('ipfsd-ctl')
const ipfsExec = require('../utils/ipfs-exec')
const path = require('path')
const df = DaemonFactory.create({
type: 'js',
IpfsClient: require('ipfs-http-client')
})
const expect = chai.expect
chai.use(dirtyChai)

const config = {
Bootstrap: [],
Expand Down
2 changes: 1 addition & 1 deletion test/cli/progress-bar.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const expect = require('chai').expect
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const createProgressBar = require('../../src/cli/utils').createProgressBar

describe('progress bar', () => {
Expand Down
5 changes: 1 addition & 4 deletions test/cli/pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
/* eslint-env mocha */
'use strict'

const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const delay = require('delay')
const series = require('async/series')
const ipfsExec = require('../utils/ipfs-exec')
Expand Down
2 changes: 1 addition & 1 deletion test/cli/refs-local.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const expect = require('chai').expect
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const runOnAndOff = require('../utils/on-and-off')

describe('refs-local', () => runOnAndOff((thing) => {
Expand Down
2 changes: 1 addition & 1 deletion test/cli/refs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const expect = require('chai').expect
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const runOnAndOff = require('../utils/on-and-off')

// Note: There are more comprehensive tests in interface-js-ipfs-core
Expand Down
2 changes: 1 addition & 1 deletion test/cli/repo.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const expect = require('chai').expect
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const repoVersion = require('ipfs-repo').repoVersion
const runOnAndOff = require('../utils/on-and-off')

Expand Down
5 changes: 1 addition & 4 deletions test/cli/swarm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
/* eslint-env mocha */
'use strict'

const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const sinon = require('sinon')
const ipfsExec = require('../utils/ipfs-exec')
const path = require('path')
Expand Down
2 changes: 1 addition & 1 deletion test/cli/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'use strict'

const os = require('os')
const expect = require('chai').expect
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const repoVersion = require('ipfs-repo').repoVersion
const pkgversion = require('../../package.json').version
const runOnAndOff = require('../utils/on-and-off')
Expand Down
5 changes: 1 addition & 4 deletions test/core/bitswap.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
'use strict'

const hat = require('hat')
const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const _ = require('lodash')
const series = require('async/series')
const waterfall = require('async/waterfall')
Expand Down
5 changes: 1 addition & 4 deletions test/core/block.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
/* eslint-env mocha */
'use strict'

const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const hat = require('hat')

const IPFSFactory = require('ipfsd-ctl')
Expand Down
6 changes: 1 addition & 5 deletions test/core/bootstrap.spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
/* eslint-env mocha */
'use strict'

const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)

const { expect } = require('interface-ipfs-core/src/utils/mocha')
const isNode = require('detect-node')
const IPFS = require('../../src')

Expand Down
6 changes: 1 addition & 5 deletions test/core/circuit-relay.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
/* eslint-env mocha */
'use strict'

const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)

const { expect } = require('interface-ipfs-core/src/utils/mocha')
const waterfall = require('async/waterfall')
const multiaddr = require('multiaddr')
const crypto = require('crypto')
Expand Down
6 changes: 1 addition & 5 deletions test/core/config.spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
/* eslint-env mocha */
'use strict'

const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)

const { expect } = require('interface-ipfs-core/src/utils/mocha')
const config = require('../../src/core/config')

describe('config', () => {
Expand Down
5 changes: 1 addition & 4 deletions test/core/create-node.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
/* eslint-env mocha */
'use strict'

const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const series = require('async/series')
const sinon = require('sinon')
const waterfall = require('async/waterfall')
Expand Down
Loading

0 comments on commit b373ce3

Please sign in to comment.