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

Extremely slow for huge snapshots mismatch #2764

Closed
6 tasks done
Maxim-Mazurok opened this issue Jan 29, 2023 · 3 comments · Fixed by #2828
Closed
6 tasks done

Extremely slow for huge snapshots mismatch #2764

Maxim-Mazurok opened this issue Jan 29, 2023 · 3 comments · Fixed by #2828

Comments

@Maxim-Mazurok
Copy link
Contributor

Describe the bug

I have a huge snapshot (38k lines JS Map), when I run vitest in either dev or run modes - it takes insane amount of time to get response, one might think that it just hangs.

Reproduction

My test:

import { it, describe, expect } from "vitest";

describe("something", () => {
  it("works", () => {
    expect(something()).toMatchSnapshot();
  });
});

My snapshot:

// Vitest Snapshot v1

exports[`something > works 1`] = `
Map {
  "Cucumber Lebanese" => [
    {
      "amountPerUnit": 5,
      "dateTime": "2020-01-01T01:01:00.000Z",
      "item": {
        "amount": 1,
        "description": "Cucumber Lebanese",
        "onSpecial": false,
        "productSeries": "Cucumber Lebanese",
        "quantity": 1,
      },
    },
    // repeat 3 times
    }
  ],
  // repeat 1000 times

When I run tests, I get this:

 FAIL  util.spec.ts > something > works
AssertionError: Snapshot `something > works 1` mismatched
 ❯ util.spec.ts:6:42
      4| describe("something", () => {
      5|   it("works", () => {
      6|     expect(something()).toMatchSnapshot();
       |                                          ^
      7|   });
      8| });

and then the process keeps on running while using ~10-20% of CPU.

After a long time I think the process fails with non-zero code without showing diff, but I'm not 100% sure about that.

Might be related to #2008

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i9-12900H
    Memory: 32.59 GB / 63.68 GB
  Binaries:
    Node: 19.3.0 - ~\AppData\Local\nvs\node\19.3.0\x64\node.EXE
    npm: 9.2.0 - ~\AppData\Local\nvs\node\19.3.0\x64\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (108.0.1462.76)
    Internet Explorer: 11.0.19041.1566

Used Package Manager

npm

Validations

@github-actions
Copy link

Hello @Maxim-Mazurok. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction will be closed if they have no activity within 3 days.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 3, 2023
@sheremet-va sheremet-va reopened this Feb 3, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 7, 2023
@sheremet-va
Copy link
Member

#2828 should fix this issue, please let me know if it does

@Maxim-Mazurok
Copy link
Contributor Author

It does, see #2828 (comment)
Thank you, please consider reopening this issue

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

Successfully merging a pull request may close this issue.

2 participants