You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now I only have two options, but none of them fits our need.
Having all the *.js.md and *.js.snap files inside the MenuComponent folder
Use snapshotDir options to have *.js.md and *.js.snap files inside another root folder.
Use case
We like to have components separated per folder and almost everything, tests included, related to that component is in that folder.
Sometimes we have also sub-components (components that are going to be used only in that component) inside a component folder, so that folder is not always nice an clean like the one in the example.
Since *.js.md and *.js.snap are generated file, they do not require much human interaction. We'd like to have them separated from the files where an human interaction is required.
Solution
We'd like to add a configuration parameter called snapshotLocalDir where you can specify the name of the folder you want to use.
In the example above that name would be snapshots.
Actions
I'm more than happy to create a PR for this one, if you guys think it's a good idea.
The text was updated successfully, but these errors were encountered:
Interesting. Leaving them in the same directory as the test file was an intentional decision. The tradeoffs are tricky here, and what you're trying to accomplish seems reasonable to me.
I'm curious what other snapshot users think though.
Lest we add yet another configuration option, perhaps we can support a special pattern in the snapshotDir configuration. If the value starts with */ it's considered relative to the directory that contains the test file. So for your use case you'd specify */snapshots. All other values would follow the current behavior.
I'm happy re-using the same configuration option, but I personally would avoid the */ since it's too much related with the Glob syntax.
What about something more explicit like TEST_FILE_FOLDER (with some prefix/suffix), used in the same way you proposed?
I'm looking for a similar feature.
My tests are located at test/api/*.spec.js
I already have a snapshot directory called baselines that's also used by other tests.
Now I want to save my snapshots there using --snapshot-dir baselines. Unfortunately that creates baselines/test/api/*.spec.js.snap while I would prefer baselines/api/*.spec.js.snap.
Long story short: I'd like to be able to replace test/ with baselines/ and leave everything else the same.
I see that this is very hard to do right for everyone while still maintaining an understandable configuration. I just wanted to share my use case.
Description
I would like to save the snapshots files inside a folder where the test file is.
Example
This is a classic React component folder structure of what I'd like to have:
Which are the current options?
Right now I only have two options, but none of them fits our need.
*.js.md
and*.js.snap
files inside theMenuComponent
foldersnapshotDir
options to have*.js.md
and*.js.snap
files inside another root folder.Use case
We like to have components separated per folder and almost everything, tests included, related to that component is in that folder.
Sometimes we have also sub-components (components that are going to be used only in that component) inside a component folder, so that folder is not always nice an clean like the one in the example.
Since
*.js.md
and*.js.snap
are generated file, they do not require much human interaction. We'd like to have them separated from the files where an human interaction is required.Solution
We'd like to add a configuration parameter called
snapshotLocalDir
where you can specify the name of the folder you want to use.In the example above that name would be
snapshots
.Actions
I'm more than happy to create a PR for this one, if you guys think it's a good idea.
The text was updated successfully, but these errors were encountered: