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

Build failure with Jest snapshot errors #14

Closed
mohanraj-r opened this issue May 29, 2020 · 8 comments
Closed

Build failure with Jest snapshot errors #14

mohanraj-r opened this issue May 29, 2020 · 8 comments

Comments

@mohanraj-r
Copy link
Contributor

Build is failing with Jest snapshot errors saying they are not up-to-date - but the updated snapshots have been checked in and the tests pass locally after a clean build. Even checked out the branch to a diff clean location in my machine and tried out the CI commands - no issues 😕

Originally posted by @mohanraj-r in #13 (comment)

mohanraj-r pushed a commit that referenced this issue May 29, 2020
@mohanraj-r
Copy link
Contributor Author

Replaced the --ci option to jest with --updateSnapshot to see what happens as a temp workaround and that causes the build to pass

$ jest --coverage --updateSnapshot
PASS packages/assert/__tests__/assert.test.ts
 › 4 snapshots updated.
PASS packages/jest/__tests__/matcher.test.ts
 › 4 snapshots updated.
PASS packages/test-utils/__tests__/test-utils.test.ts
 › 2 snapshots updated.
PASS packages/preset-rules/__tests__/rules.test.ts
PASS packages/jest/__tests__/setup.test.ts
PASS packages/format/__tests__/format.test.ts
 › 1 snapshot updated.
...
Snapshot Summary
 › 11 snapshots updated from 4 test suites.

Test Suites: 7 passed, 7 total
Tests:       38 passed, 38 total
Snapshots:   11 updated, 7 passed, 18 total
Time:        6.225 s
Ran all test suites in 2 projects.
Done in 13.35s.

But think --updateSnapshot isn't supposed to be used in CI and kind of defeats the purpose of snapshot testing? Doesn't it @trevor-bliss ?

mohanraj-r pushed a commit that referenced this issue May 29, 2020
mohanraj-r pushed a commit that referenced this issue May 30, 2020
mohanraj-r pushed a commit that referenced this issue May 30, 2020
@mohanraj-r
Copy link
Contributor Author

Tried reverting

  • unicode chars in err msg
  • print received jest helper
  • expected, received num of issues to the matcher hint msg

Same snapshot issues as before 😞
Guess it is good in a way that if one of these workarounds had worked, it would have raised more questions. But then the mystery continues ..

@trevor-bliss
Copy link

Yeah, definitely don't keep --updateSnapshot running in the CI :)

Something else I thought of to try... I see the CI is set to run on ubuntu. Are you generating the snapshots locally on a Mac? If so, let's try setting the runs-on value to:

runs-on: macos-latest

mohanraj-r pushed a commit that referenced this issue Jun 1, 2020
revert workarounds tested for #14
mohanraj-r pushed a commit that referenced this issue Jun 1, 2020
check if the snapshot errors could be related to OS #14
@mohanraj-r
Copy link
Contributor Author

Thanks Trevor, I was thinking about the OS too.

mohanraj-r pushed a commit that referenced this issue Jun 1, 2020
mohanraj-r pushed a commit that referenced this issue Jun 1, 2020
@mohanraj-r
Copy link
Contributor Author

@trevor-bliss Resolved this issue by switching to circleci. Tests all pass now 😌
Have to figure out how to get codecov working with e.g. codecov.io - will do it after this PR
Will get back to taking care of the comments on the PR

@mohanraj-r
Copy link
Contributor Author

Created Test workflow is failing with Jest snapshot errors · Issue #159 · actions/setup-node and also filed a github support ticket.

@trevor-bliss
Copy link

I'm a big fan of CircleCI so I don't think this is a huge loss :P

@mohanraj-r
Copy link
Contributor Author

Good to know :)
Btw, ran into some issues trying to setup codecov.io for this repo - apparently because the repo is private - guess will have to wait till its open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants