File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -186,7 +186,7 @@ internals.root = function () {
186
186
187
187
this . assert ( extensions , root . extensionsSchema ) ;
188
188
189
- const joi = Object . assign ( { } , this ) ;
189
+ const joi = Object . create ( this ) ;
190
190
191
191
for ( let i = 0 ; i < extensions . length ; ++ i ) {
192
192
const extension = extensions [ i ] ;
Original file line number Diff line number Diff line change @@ -2646,5 +2646,17 @@ describe('Joi', () => {
2646
2646
done ( ) ;
2647
2647
} ) ;
2648
2648
} ) ;
2649
+
2650
+ it ( 'should return a custom Joi as an instance of Any' , ( done ) => {
2651
+
2652
+ const customJoi = Joi . extend ( {
2653
+ name : 'myType'
2654
+ } ) ;
2655
+
2656
+ const Any = require ( '../lib/any' ) ;
2657
+ expect ( customJoi ) . to . be . an . instanceof ( Any ) ;
2658
+ done ( ) ;
2659
+ } ) ;
2660
+
2649
2661
} ) ;
2650
2662
} ) ;
You can’t perform that action at this time.
0 commit comments