Skip to content

Bigint does not display correctly in Command Log, throws error on print to console of 0n #16570

@dhorkin

Description

@dhorkin

Current behavior

There are currently two issues with bigint in cypress.

  1. when it prints log output, it says {} instead of serializing the bigint. If you click on the assertion, it displays properly in the console:
    image
  2. If either the expected or actual value is 0n, you get an exception when you click on it:
    image

Desired behavior

  • Bigints assertions should display their values in the command log (possibly with truncation)
  • if you click on a bigint assertion that has 0n on expected or actual, no exception should occur

Test code to reproduce

describe('Bigint example', () => {
    it('Displays wrong', () => {
        expect(2n).to.equal(2n);
    });

    it('Exception on inspect', () => {
        expect(1n).to.equal(0n);
    })

    it('Exception on inspect 2', () => {
        expect(0n).to.equal(1n);
    })
});

Versions

This is present in 5.6.0 through 7.3.0, though you get different behavior for the exception in 5.6.0 and 7.3.0. In older versions, it doesn't show the exception and stack trace, but expected/actual are missing:
image
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    pkg/runnerThis is due to an issue in the packages/runner directorytype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions