Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions chai.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions lib/chai/utils/inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 10 additions & 0 deletions test/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down