jest: Snapshot Update Command Incorrect

Do you want to request a feature or report a bug?

bug

What is the current behavior?

I run jest with this weird command:

npm start test.server

When I do that and it encounters a snapshot error it returns the following:

Snapshot Summary
 › 2 obsolete snapshots found, run with `npm start -- -u` to remove them.

That is not the correct command.

If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can yarn install and yarn test.

What is the expected behavior?

I expect it to provide the correct instructions to update the snapshots:

npm start test.server -- -u

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.

  • jest 18.10
  • npm 3 or yarn depending on my mood
  • mac os 10.11 (el capitan)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 23 (12 by maintainers)

Most upvoted comments

Makes sense. Thank you for explaining. Perhaps ya’ll could have a GitHub saved reply to explain this so it doesn’t discourage potential contributors.

@marcinlesek the extra – is a limitation of npm, it’s the only way to pass args through

If you use yarn you could run:

yarn unit -u

Does running npm run unit -- -u help?

@kentcdodds Jest is operating under extremely limited resources. We simply cannot keep up on issues. We’d like to keep our bug tracker useful and we aggressively (sometimes too aggressively) close issues if we believe that the team cannot or will not resolve them within the next 3 months or so. We are always happy to keep the discussion going and reopen issues if necessary.

For this issue in particular, I agree it is an odd setup but if npm isn’t giving us the necessary information, we’d probably have to do something hacky to get to the real command. I’d also like to call out that we don’t print yarn test -u yet because we have no code to detect yarn yet.

@kentcdodds hm, I didn’t thought it could be disheartening, sorry if you felt this way @xjamundx!

So… while writing this response I realised that I misread the npm start thus my logic was flawed.

Reopening this. @xjamundx if you feel like working on fixing this, if possible, I’m glad to help.