-
-
Notifications
You must be signed in to change notification settings - Fork 709
Closed
Description
Although BigInts are a stage 3 proposal, they are supported in Node 10 and V8 6.3. One of the quirks of BigInt is that it's not JSON serializable. When attempting to compare two BigInts, chai uses the JSON, which produces the wrong result.
Here's a minimum example, which works on Node 10 and Chai 4.1.2
> let chai = require('chai')
> chai.should()
> 1n.should.equal(1n)
// ↪AssertionError: expected {} to equal {}
> 1234n.should.equal(123n)
// ↪AssertionError: expected {} to equal {}I think Chai should check if typeof returns 'bigint'
> typeof 123n
// ↪'bigint'And use equality to make the comparison in that case (and toString()) instead of JSON serialization.
I'm happy to take a look at this if this is something that others think Chai should support.
Metadata
Metadata
Assignees
Labels
No labels