rules_jest icon indicating copy to clipboard operation
rules_jest copied to clipboard

[Bug]: InlineSnapshots don't work

Open Aghassi opened this issue 7 months ago • 1 comments

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 avatar Nov 06 '23 16:11 Aghassi