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

Add option to dump all children #597

Closed
wants to merge 2 commits into from

Conversation

tahirmt
Copy link
Contributor

@tahirmt tahirmt commented Apr 8, 2022

Adding an option to dump to render all children without requiring implementations for the AnySnapshotStringConvertible protocol default value.

Also create several other protocols to control how children are processed for the dump. Not too happy with the naming so happy to change thaat

  • AnySnapshotStringConvertibleIncludedNodesProvider: Adds an option to choose which nodes to include from the children. If a type implements this protocol it can provide an array of children to include in the dump
  • AnySnapshotStringConvertibleExcludedNodesProvider: Adds an option to exclude select children from the dump. Useful when a type has unnecessary properties we want to exclude from the dump
  • AnySnapshotStringConvertibleDumpChildNodes: When this is implemented children will be included for AnySnapshotStringConvertible such as NSObject subclasses
  • AnySnapshotStringConvertibleIgnoreChildNodes: Implementing types will ignore all children from the dump.

This is also a solution to #596

@stephencelis
Copy link
Member

Hi @tahirmt! Thanks for the contribution. The "dump" snapshot strategy predates our Custom Dump library, which we think is better suited to be used for a snapshot strategy these days (and in the future). Because of this, we'd rather move in that direction (by providing a plug-in that connects Snapshot Testing and Custom Dump) than make any changes to the existing strategy. Ideally we would eventually deprecate the existing strategy in favor of the plug-in. Thanks again for this, though! If you end up releasing your own plug-in, we'd be happy to list it in the README!

@tahirmt
Copy link
Contributor Author

tahirmt commented Sep 21, 2022

That's a good point. I can look into that.

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

Successfully merging this pull request may close these issues.

2 participants