File tree 2 files changed +22
-0
lines changed
2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ export {AssertionError};
31
31
*/
32
32
export function use ( fn : UseFn ) : Record < string , unknown > {
33
33
const exports = {
34
+ use,
34
35
AssertionError,
35
36
util,
36
37
config,
Original file line number Diff line number Diff line change @@ -24,6 +24,27 @@ describe('plugins', function () {
24
24
} ) . to . not . throw ( ) ;
25
25
} ) ;
26
26
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
+
27
48
it ( '.use detached from chai object' , function ( ) {
28
49
function anotherPlugin ( chai ) {
29
50
Object . defineProperty ( chai . Assertion . prototype , 'moreTesting' , {
You can’t perform that action at this time.
0 commit comments