Closed mackoj closed 5 months ago
The only missing part is https://github.com/doordash-oss/swiftui-preview-snapshots/pull/8.
There was good discussion in the linked PR. In the end the current plan is to not add specific snapshot directory support since in the upstream swift-snapshot-testing
consumers also have to manually use/wrap verifySnapshot
in order to use custom directories, and the for loop over the configurations is pretty trivial to write.
https://github.com/doordash-oss/swiftui-preview-snapshots/pull/8#issuecomment-1934671492
Hi @jflan-dd,
Description:
The library currently lacks the ability to specify a custom snapshot directory. This feature would be incredibly useful, particularly in scenarios where tests are distributed across various folders, as it allows for centralizing all snapshots into a designated directory at the root of the tests folder.
Proposed Solution:
Introducing an endpoint within the
swift-snapshot-testing
library, such asverifySnapshot
, would enable users to customize the snapshot directory. By providing this capability, users could seamlessly integrate the library into their projects while maintaining organizational consistency.Request:
Could the API be extended to incorporate the
verifySnapshot
functionality alongside or instead ofassertSnapshot
?Solution
For the moment I added this to my project. This code will allow me using custom snapshot directory but in order to make it work. I need a
.snapshotName(prefix:)
to be public.Thank you!