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

customSnapshotsDir as function #62

Closed
satispunk opened this issue Mar 31, 2018 · 4 comments
Closed

customSnapshotsDir as function #62

satispunk opened this issue Mar 31, 2018 · 4 comments

Comments

@satispunk
Copy link

Would be good to have customSnapshotsDir specified as function

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

so it is possible to generated path on the fly depending on testName, testPath and env variables

Use cases:

  1. Keep test folder structure in images folder. (I guess this can be even a separate option like "keepFolderStructure")
  2. Possible to use env variables, the same tests may produce different screenshots depending on env. IN my case: run the same test for components but different theme. Theme is set as env variable.
@jacobweber
Copy link

Same would be useful for customSnapshotIdentifier.

Jyrno42 added a commit to Jyrno42/jest-image-snapshot that referenced this issue May 22, 2019
Jyrno42 added a commit to Jyrno42/jest-image-snapshot that referenced this issue May 22, 2019
Jyrno42 added a commit to Jyrno42/jest-image-snapshot that referenced this issue May 27, 2019
Jyrno42 added a commit to Jyrno42/jest-image-snapshot that referenced this issue Jun 5, 2019
@anescobar1991
Copy link
Member

Resolved by #140.

@jepstein-eagle
Copy link

jepstein-eagle commented Sep 11, 2019

This issue is marked resolved by #140. That does help by allowing us to customize the customSnapshotIdentifier. However, we can not use a function to configure the snapshots directory, as would allow for some additional use use-cases.

Can we enable the customSnapshotsDirto use a similar function?

@anescobar1991
Copy link
Member

Yeah feel free to open a PR implementing that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants