diff --git a/lib/chai.js b/lib/chai.js index 507d9c76..734e3725 100644 --- a/lib/chai.js +++ b/lib/chai.js @@ -29,6 +29,7 @@ export {AssertionError}; */ export function use(fn) { const exports = { + use, AssertionError, util, config, diff --git a/test/plugins.js b/test/plugins.js index 4db1f44d..c9c013cc 100644 --- a/test/plugins.js +++ b/test/plugins.js @@ -24,6 +24,27 @@ describe('plugins', function () { }).to.not.throw(); }); + it('nested plugin', function () { + chai.use(function (chai) { + chai.use(plugin); + }); + var expect = chai.expect; + expect(expect('').testing).to.equal('successful'); + }); + + it('chained plugin', function () { + chai.use(function (chaiObj) { + Object.defineProperty(chaiObj.Assertion.prototype, 'testing2', { + get() { + return 'bleep bloop'; + } + }); + }).use(plugin); + var expect = chai.expect; + expect(expect('').testing).to.equal('successful'); + expect(expect('').testing2).to.equal('bleep bloop'); + }); + it('.use detached from chai object', function () { function anotherPlugin (chai) { Object.defineProperty(chai.Assertion.prototype, 'moreTesting', {