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 @@ -29,6 +29,7 @@ export {AssertionError};
29
29
*/
30
30
export function use ( fn ) {
31
31
const exports = {
32
+ use,
32
33
AssertionError,
33
34
util,
34
35
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