Skip to content

[Bug]: InlineSnapshots don't work #193

Open
@Aghassi

Description

@Aghassi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedAspect isn't prioritizing this, but the community couldneed: fundingWe could prioritize this based on donation to https://opencollective.com/aspect-build

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions