File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ export {AssertionError};
2929 */
3030export function use ( fn ) {
3131 const exports = {
32+ use,
3233 AssertionError,
3334 util,
3435 config,
Original file line number Diff line number Diff 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' , {
You can’t perform that action at this time.
0 commit comments