Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI output flips actual and expected in diff #3717

Closed
6 tasks done
aklinker1 opened this issue Jul 2, 2023 · 1 comment
Closed
6 tasks done

CLI output flips actual and expected in diff #3717

aklinker1 opened this issue Jul 2, 2023 · 1 comment

Comments

@aklinker1
Copy link

aklinker1 commented Jul 2, 2023

Describe the bug

For the following test, the actual value is printed as the - Expected green text, when it should be printed as the + Received red text.

import { expect, test } from "vitest";

const getText = () => "actual text";

test("demo", () => {
  const expected = "expected text";
  const actual = getText();

  expect(actual).toBe(expected);
});

Screenshot 2023-07-02 at 3 06 55 PM

After some debugging, it appear to have been broken in v0.32.1 with the new text diff that is used, likely introduced in #3582

Version differences

Screenshot 2023-07-02 at 3 18 19 PM

Screenshot 2023-07-02 at 3 17 37 PM

Reproduction

Here's the project with the above test in it. repro.zip

System Info

System:
    OS: macOS 13.4.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 258.06 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.17.0 - ~/.asdf/installs/nodejs/lts/bin/node
    Yarn: 1.22.19 - ~/.asdf/installs/nodejs/lts/.npm/bin/yarn
    npm: 8.15.0 - ~/.asdf/plugins/nodejs/shims/npm
    pnpm: 7.15.0 - ~/.asdf/installs/nodejs/lts/.npm/bin/pnpm
  Browsers:
    Chrome: 114.0.5735.198
    Safari: 16.5.1
  npmPackages:
    vitest: ^0.32.2 => 0.32.2 

Used Package Manager

pnpm

Validations

@sheremet-va
Copy link
Member

It's fixed, but the fix is not released yet

@github-actions github-actions bot locked and limited conversation to collaborators Jul 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants