Skip to content

Commit 3639b0d

Browse files
committed
Merge branch 'main' into typescript
2 parents 6a5f336 + 3bc02ee commit 3639b0d

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/chai.ts

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export {AssertionError};
3131
*/
3232
export function use(fn: UseFn): Record<string, unknown> {
3333
const exports = {
34+
use,
3435
AssertionError,
3536
util,
3637
config,

test/plugins.js

+21
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,27 @@ describe('plugins', function () {
2424
}).to.not.throw();
2525
});
2626

27+
it('nested plugin', function () {
28+
chai.use(function (chai) {
29+
chai.use(plugin);
30+
});
31+
var expect = chai.expect;
32+
expect(expect('').testing).to.equal('successful');
33+
});
34+
35+
it('chained plugin', function () {
36+
chai.use(function (chaiObj) {
37+
Object.defineProperty(chaiObj.Assertion.prototype, 'testing2', {
38+
get() {
39+
return 'bleep bloop';
40+
}
41+
});
42+
}).use(plugin);
43+
var expect = chai.expect;
44+
expect(expect('').testing).to.equal('successful');
45+
expect(expect('').testing2).to.equal('bleep bloop');
46+
});
47+
2748
it('.use detached from chai object', function () {
2849
function anotherPlugin (chai) {
2950
Object.defineProperty(chai.Assertion.prototype, 'moreTesting', {

0 commit comments

Comments
 (0)