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

Snapshots are reported to be written but are not #5270

Closed
versae opened this issue Jan 9, 2018 · 9 comments · Fixed by #7080
Closed

Snapshots are reported to be written but are not #5270

versae opened this issue Jan 9, 2018 · 9 comments · Fixed by #7080

Comments

@versae
Copy link

versae commented Jan 9, 2018

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

What is the current behavior?
After running yarn test -u --no-cache /node_modules/.bin/jest test --all --updateSnapshot --no-cache I see the message 5 snapshots written, but no snapshots are actually written anywhere.

screen shot 2018-01-09 at 12 33 09 pm

Therefore, when running with --ci in Travis it fails.

screen shot 2018-01-09 at 12 35 50 pm

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.

No minimal repository, sorry. But this branch should serve as an example. yarn install and yarn test is all you need to reproduce the error.

What is the expected behavior?
It should write the snapshots in the /webpack/__tests__/__snapshots__ folder.

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

Tried with the latest versions of everything, didn't make much different. Current config for the branch linked above is:

  "jest": {
    "setupFiles": [
      "./webpack/config/shim.js",
      "./webpack/config/setupTests.js"
    ],
    "snapshotSerializers": ["enzyme-to-json/serializer"],
    "testPathIgnorePatterns": [
      "<rootDir>/webpack/config/",
      "<rootDir>/webpack/__tests__/__fixtures__/"
    ]
  },

Versions:

$ ./node_modules/.bin/jest --version
v21.2.1
$ nvm version
v8.9.4
$ yarn --version
1.2.1
$ npm --version
5.6.0
$ sw_vers -productName
Mac OS X
$ sw_vers -productVersion
10.13.2
@anilreddykatta
Copy link
Contributor

@versae Sorry, if I miss anything. Are you checking snapshots as part of PR? Snapshots should be included as part of PR (unless we explicitly allow CI to write snapshots back into the repo). Do you mind confirming this one?

@versae
Copy link
Author

versae commented Jan 10, 2018

Sure. Yes, all other snapshots are being created correctly and checked in the repo. It's just the ones for the /webpack/__tests__/parser.spec.js that are not being created.

@versae
Copy link
Author

versae commented Jan 10, 2018

Closing the issue. It was related to mocking the filesystem module fs and using Promises at the same time. Don't forget your done()'s!

@versae versae closed this as completed Jan 10, 2018
@SimenB
Copy link
Member

SimenB commented Jan 10, 2018

Still not good that we print that it's being written when it's not. Or that you have access to the same fs and can mess up the runner

@versae
Copy link
Author

versae commented Jan 10, 2018

Reopen as per @SimenB comment.

@versae versae reopened this Jan 10, 2018
@stereobooster
Copy link

stereobooster commented Jun 20, 2018

Also experiencing this bug https://travis-ci.org/stereobooster/react-ideal-image/jobs/394213438

Locally tests pass, but fail on Travis. Related stereobooster/react-ideal-image#38

@StarpTech
Copy link

StarpTech commented Sep 30, 2018

I have the same bug like @stereobooster they works locally but fail on travis CI.
https://travis-ci.org/Prettyhtml/prettyhtml/jobs/435324082

All snapshots files are checked in the source control.

@StarpTech
Copy link

@SimenB I think my issue and @stereobooster doesn't belong to this issue right? I opened #7094

@github-actions
Copy link

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 May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants