File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -8746,6 +8746,9 @@ function formatPrimitive(ctx, value) {
8746
8746
8747
8747
case 'symbol' :
8748
8748
return ctx . stylize ( value . toString ( ) , 'symbol' ) ;
8749
+
8750
+ case 'bigint' :
8751
+ return ctx . stylize ( value . toString ( ) + 'n' , 'bigint' ) ;
8749
8752
}
8750
8753
// For some reason typeof null is "object", so special case here.
8751
8754
if ( value === null ) {
Original file line number Diff line number Diff line change @@ -218,6 +218,9 @@ function formatPrimitive(ctx, value) {
218
218
219
219
case 'symbol' :
220
220
return ctx . stylize ( value . toString ( ) , 'symbol' ) ;
221
+
222
+ case 'bigint' :
223
+ return ctx . stylize ( value . toString ( ) + 'n' , 'bigint' ) ;
221
224
}
222
225
// For some reason typeof null is "object", so special case here.
223
226
if ( value === null ) {
Original file line number Diff line number Diff line change @@ -756,6 +756,16 @@ describe('utilities', function () {
756
756
} ) ;
757
757
} ) ;
758
758
759
+ it ( 'inspect BigInt' , function ( ) {
760
+ if ( typeof BigInt !== 'function' ) return ;
761
+
762
+ chai . use ( function ( _chai , _ ) {
763
+ expect ( _ . inspect ( BigInt ( 0 ) ) ) . to . equal ( '0n' ) ;
764
+ expect ( _ . inspect ( BigInt ( 1234 ) ) ) . to . equal ( '1234n' ) ;
765
+ expect ( _ . inspect ( BigInt ( - 1234 ) ) ) . to . equal ( '-1234n' ) ;
766
+ } ) ;
767
+ } ) ;
768
+
759
769
it ( 'inspect every kind of available TypedArray' , function ( ) {
760
770
chai . use ( function ( _chai , _ ) {
761
771
var arr = [ 1 , 2 , 3 ]
You can’t perform that action at this time.
0 commit comments