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]: updateSnapshot cannot parse jsx #12000

Closed
TrySound opened this issue Oct 27, 2021 · 10 comments
Closed

[Bug]: updateSnapshot cannot parse jsx #12000

TrySound opened this issue Oct 27, 2021 · 10 comments

Comments

@TrySound
Copy link
Contributor

Version

27.3.1

Steps to reproduce

https://github.com/TrySound/jest-update-snapshot-bug

Install deps and run yarn jest --updateSnapshot

The problem is passed root to babel parser which is the directory of test file. This means each test directory need to have own babel.config.js

Expected behavior

Successfully parsed jsx and other syntax

Actual behavior

Failed with syntax error

Additional context

No response

Environment

Mac os
Node 16.10
Yarn 1
@TrySound
Copy link
Contributor Author

@SimenB
Copy link
Member

SimenB commented Oct 27, 2021

We can probably just add the syntax plugin?

https://github.com/facebook/jest/blob/3d04f33daa3b9ec21838c9177ab7acab8c983155/packages/jest-snapshot/src/InlineSnapshots.ts#L80-L90

or can we improve the root argument?

@TrySound
Copy link
Contributor Author

Better improve as I use also flow. Whats the point of root?

@SimenB
Copy link
Member

SimenB commented Oct 27, 2021

No idea. @jeysal?

@jeysal
Copy link
Contributor

jeysal commented Oct 27, 2021

I think this is the same thing (?) as what is discussed in #11741

@jeysal
Copy link
Contributor

jeysal commented Oct 27, 2021

also, gz on getting the number #12000 :P

@TrySound
Copy link
Contributor Author

Hehe

Ouch, didnt look that far for similar issue. Pretty old one. I guess i never updated snapshots last year.

@github-actions
Copy link

This issue is stale because it has been open for 1 year 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 Oct 27, 2022
@SimenB
Copy link
Member

SimenB commented Oct 28, 2022

This was fixed in #12760

@SimenB SimenB closed this as completed Oct 28, 2022
@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 Nov 28, 2022
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