Skip to content

After switch to concordance, diff on large objects sometimes does not show #3560

@ldiqual

Description

@ldiqual

Describe the bug

The following test fails as expected, but doesn't print the diff between actual & expected: https://gist.github.com/ldiqual/f874381a2e836fc57ca8c07be9f2f397
I believe this is due to https://github.com/vitest-dev/vitest/blob/main/packages/utils/src/diff.ts#L27-L28 which expects a specific color from the concordance output. However it sounds like concordance sometimes prints a 31m red plus, instead of a 32m green plus.

After inserting a bunch of console logs in @vitest/utils/diff.js, this is the raw output from concordance and the plus/minus that vitest expects:

Line:
"  +   contractSumToDatePreTax: 90909"

Raw:
"  \u001b[31m+\u001b[39m   contractSumToDatePreTax: \u001b[33m90909\u001b[39m\u001b[90m,\u001b[39m"

Plus:
"  \u001b[32m-\u001b[39m "

Minus:
"  \u001b[32m+\u001b[39m"

Reproduction

Run the following test: https://gist.github.com/ldiqual/f874381a2e836fc57ca8c07be9f2f397

System Info

System:
    OS: macOS 13.4
    CPU: (10) arm64 Apple M1 Pro
    Memory: 111.31 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.16.0 - ~/Library/Caches/fnm_multishells/27761_1686604561032/bin/node
    Yarn: 3.6.0 - ~/Library/Caches/fnm_multishells/27761_1686604561032/bin/yarn
    npm: 9.5.1 - ~/Library/Caches/fnm_multishells/27761_1686604561032/bin/npm
  Browsers:
    Chrome: 114.0.5735.106
    Firefox: 109.0
    Safari: 16.5
  npmPackages:
    @vitejs/plugin-react-swc: 3.3.2 => 3.3.2
    vite: 4.3.9 => 4.3.9
    vitest: 0.32.0 => 0.32.0

Used Package Manager

yarn

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions