americanexpress / jest-image-snapshot

✨ Jest matcher for image comparisons. Most commonly used for visual regression testing.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request - Global configuration of options

bestow-jd opened this issue · comments

Please correct me if this already exists (and point me to how/where), but it would be helpful to have global option configuration.
In our setup, we're using a root folder for our snapshots.
It would be helpful to not have to add this option to every function call and instead set some global options.
Instead of doing this on every call

expect(screenshot).toMatchImageSnapshot({
  customSnapshotsDir: "visual_regression_snapshots",
});

It would be nice to do something more along the lines of:

expect.extend({ toMatchImageSnapshot({
      customSnapshotsDir: "visual_regression_snapshots",
    })
});

and then allow function calls to override options, but have the custom defaults.

This is already possible with the “configureToMatchImageSnapshot” function as seen in the README.