Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
fix: configure chai for use by other modules
Browse files Browse the repository at this point in the history
Workaround for chaijs/chai#1298

The order in which plugins are applied to chai is important and
can break tests in other modules that run the tests from this one.
  • Loading branch information
achingbrain committed Oct 4, 2019
1 parent ac4d362 commit 77c8be9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"bs58": "^4.0.1",
"callbackify": "^1.1.0",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"cids": "~0.7.1",
"concat-stream": "^2.0.0",
"delay": "^4.3.0",
Expand Down
7 changes: 1 addition & 6 deletions src/key/rename.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@
/* eslint max-nested-callbacks: ["error", 6] */
'use strict'

const chai = require('chai')
const dirtyChai = require('dirty-chai')
const hat = require('hat')
const { getDescribe, getIt } = require('../utils/mocha')

const expect = chai.expect
chai.use(dirtyChai)
const { getDescribe, getIt, expect } = require('../utils/mocha')

module.exports = (createCommon, options) => {
const describe = getDescribe(options)
Expand Down
5 changes: 3 additions & 2 deletions src/utils/mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
'use strict'

const chai = require('chai')
const dirtyChai = require('dirty-chai')

chai.use(dirtyChai)
// Do not reorder these statements - https://github.com/chaijs/chai/issues/1298
chai.use(require('chai-as-promised'))
chai.use(require('dirty-chai'))

module.exports.expect = chai.expect

Expand Down

0 comments on commit 77c8be9

Please sign in to comment.