mirror of
https://github.com/chaijs/chai
synced 2024-11-13 23:37:07 +00:00
parent
dc858a0353
commit
5b607a144e
3 changed files with 16 additions and 0 deletions
3
chai.js
3
chai.js
|
@ -8746,6 +8746,9 @@ function formatPrimitive(ctx, value) {
|
|||
|
||||
case 'symbol':
|
||||
return ctx.stylize(value.toString(), 'symbol');
|
||||
|
||||
case 'bigint':
|
||||
return ctx.stylize(value.toString() + 'n', 'bigint');
|
||||
}
|
||||
// For some reason typeof null is "object", so special case here.
|
||||
if (value === null) {
|
||||
|
|
|
@ -218,6 +218,9 @@ function formatPrimitive(ctx, value) {
|
|||
|
||||
case 'symbol':
|
||||
return ctx.stylize(value.toString(), 'symbol');
|
||||
|
||||
case 'bigint':
|
||||
return ctx.stylize(value.toString() + 'n', 'bigint');
|
||||
}
|
||||
// For some reason typeof null is "object", so special case here.
|
||||
if (value === null) {
|
||||
|
|
|
@ -756,6 +756,16 @@ describe('utilities', function () {
|
|||
});
|
||||
});
|
||||
|
||||
it('inspect BigInt', function () {
|
||||
if (typeof BigInt !== 'function') return;
|
||||
|
||||
chai.use(function (_chai, _) {
|
||||
expect(_.inspect(BigInt(0))).to.equal('0n');
|
||||
expect(_.inspect(BigInt(1234))).to.equal('1234n');
|
||||
expect(_.inspect(BigInt(-1234))).to.equal('-1234n');
|
||||
});
|
||||
});
|
||||
|
||||
it('inspect every kind of available TypedArray', function () {
|
||||
chai.use(function (_chai, _) {
|
||||
var arr = [1, 2, 3]
|
||||
|
|
Loading…
Reference in a new issue