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

Include computed vars on snapshots #102

Closed
caldofran opened this issue Nov 19, 2018 · 3 comments
Closed

Include computed vars on snapshots #102

caldofran opened this issue Nov 19, 2018 · 3 comments

Comments

@caldofran
Copy link

What's the main reason to not include computed vars on snapshots? Is it a technical limitation or it's just a design decision?

@stephencelis
Copy link
Member

Do you mean on the .dump strategy? I think this is a limitation of Swift's mirror/reflection API, which only seems to traverse non-computed properties. You can define a custom strategy or call to computed vars explicitly, though!

assertSnapshot(matching: (base: myValue, computedVar: myValue.computedVar), as: .dump)

@stephencelis
Copy link
Member

@caldofran Does this all make sense? Safe to close this out?

@caldofran
Copy link
Author

Sorry for the late response Stephen.
Your proposal fits perfectly with what I need to test computed vars. So feel free to close this issue.
Thanks!

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

No branches or pull requests

2 participants