Skip to content

Could customSnapshotDir be a callback? #347

@velvet-dream

Description

@velvet-dream

As suggested here in this issue #62

It would be really useful to have customSnapshotsDir specified as function, in order to have much more flexibility over the way snapshots are stored, and make it possible to generate path on the fly depending on testPath, etc.

{ customSnapshotsDir: ({currentTestName, testPath}) => buildCustomSnapshotDirOnTheFly(currentTestName, testPath) }

In my usecase, we have our own framework with our React components. There are many components, and I would like to get all the snapshots stored in the same directory, with a structure identical to that of the framework. Something that would look like this:

root/
├─ snapshots/
│  ├─ inputs/
│  │  ├─ button/
│  │  │  ├─ button-snapshot.png
│  │  ├─ inputNumber/
│  │  │  ├─ inputNumber-snapshot.png

A commit was submitted a few years ago : goverdhan07@0277834

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions