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]: InlineSnapshots don't work #193

Open
Aghassi opened this issue Nov 6, 2023 · 1 comment
Open

[Bug]: InlineSnapshots don't work #193

Aghassi opened this issue Nov 6, 2023 · 1 comment
Labels
bug Something isn't working untriaged Requires traige

Comments

@Aghassi
Copy link

Aghassi commented Nov 6, 2023

What happened?

Jest allows users to write toMatchInlineSnapshots, which involves writing a snapshot to the source file instead of the snapshot file itself. However, in Bazel source files are write protected so when you run test_update_snapshots you will fail to write the inline snapshot and can't update thus can't update the snapshot. This makes inline snapshots unuseable with bazel basically.

https://jestjs.io/docs/snapshot-testing#inline-snapshots

Version

Development (host) and target OS/architectures: macOS

Output of bazel --version: 6.3.0

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

Language(s) and/or frameworks involved:
rules_js
rules_ts
rules_jest
rules_swc

How to reproduce

Have a workspace that has rules_jest setup
Write a test that calls `toMatchInlineSnapshot`
Run `test_update_snapshots` on it and see it fail with `EACCES: permission denied`

Any other information?

No response

@Aghassi Aghassi added the bug Something isn't working label Nov 6, 2023
@github-actions github-actions bot added the untriaged Requires traige label Nov 6, 2023
@Aghassi
Copy link
Author

Aghassi commented Nov 6, 2023

Workarounds for this include using toStrictEqual or toMatchSnapshot. But basically, toMatchInlineSnapshot is not useable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged Requires traige
Projects
Status: No status
Development

No branches or pull requests

1 participant