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

[Bug]: regression in update snapshot command when snapshot fails in jest 29.5 #14057

Closed
mikemaccana opened this issue Apr 6, 2023 · 6 comments

Comments

@mikemaccana
Copy link
Contributor

mikemaccana commented Apr 6, 2023

Version

29.5.0

Steps to reproduce

  1. Use snapshots, have some out of date snapshots
  2. Run npx jest
  3. Get results. Not the command npm run npx -- -u doesn't make sense and won't work

Snapshot Summary
› 2 snapshots failed from 2 test suites. Inspect your code changes or run npm run npx -- -u to update them.

Expected behavior

Probably

npx jest -u would be the correct command.

Actual behavior

A suggestion to run npm run npx -- -u which doesn't even start jest

Additional context

Seems to be new in jest 29.5.0. I've just upgraded from jest 28 and don't recall seeing this before.

Environment

$ npx envinfo --preset jest
Need to install the following packages:
  envinfo@7.8.1
Ok to proceed? (y) y

  System:
    OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (4) x64 Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
  Binaries:
    Node: 18.14.2 - /usr/local/bin/node
    Yarn: 1.22.15 - /usr/bin/yarn
    npm: 9.6.2 - /usr/local/bin/npm
  npmPackages:
    jest: ^29.5.0 => 29.5.0
@ghiscoding
Copy link
Contributor

ghiscoding commented Apr 6, 2023

it might be related to a previous issue #13557 that was closed which I also have in Vitest because Vitest uses pretty-format from Jest, I'm not sure if it's pretty-format or something else from Jest Snapshot

EDIT

Actually in your case, it might not be a bug but simply the format that changed in Jest 29, see their blog Jest 29: Snapshot format changes

@mrazauskas
Copy link
Contributor

The message is the same on Jest v28.

The logic of the message lives here:

https://github.com/facebook/jest/blob/470d72ee74e50291bf8593954f24eb75b5621351/packages/jest-reporters/src/SummaryReporter.ts#L154-L173

Just fix it (;

By the way, as a Yarn 2 user I simply get: "Inspect your code changes or re-run jest with -u to update them." Makes me wonder if perhaps this is all what user needs? Should cover all use cases, or?

Related #14018

@github-actions
Copy link

github-actions bot commented May 7, 2023

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label May 7, 2023
@github-actions
Copy link

github-actions bot commented Jun 6, 2023

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 6, 2023
@github-actions
Copy link

github-actions bot commented Jun 6, 2023

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

@github-actions
Copy link

github-actions bot commented Jul 7, 2023

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 7, 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

3 participants