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

Feature Request: Support for Tabular-Assertions as a snapshot format #184

Closed
dylanbr opened this issue Jan 15, 2024 · 3 comments
Closed

Comments

@dylanbr
Copy link

dylanbr commented Jan 15, 2024

Feature Description

I'd like to propose adding a driver to allow the use of tabular-assertions as the snapshot format. This would bring some benefits, mirroring those offered by tabular-assertions:

  • Enhanced readability
  • Improved error reporting
  • And to a lesser degree, the ability to hand edit the snapshots

Potential Challenges & Solutions

  • Dynamic values in snapshots: Integrating dynamic values might be challenging, especially when considering the --update-snapshots command. A workaround could be to initially support tabular assertions without dynamic values and explore this complexity in a later phase.

Additional Feature Suggestion

  • Optional fields parameter: An optional parameter to specify and limit the columns in a tabular assertion would be a useful addition. This would provide a convenient way to control the data scope in assertions, though users could also format the data manually before asserting.

I am interested to hear your thoughts, or any plans regarding this suggestion.

Thank you for considering this feature request.

@sebastiandedeyne
Copy link
Member

After releasing tabular assertions I started wondering whether they should be two separate packages, which got me thinking about in the long term for these packages.

I think the ideal destination is supporting inline snapshots like Jest. That way there would only be snapshot testing, and the tabular notation would be just another driver to serialize the date. Users could then choose to write the tables inline or in a snapshot file.

The hard part about inline snapshots is the AST part: writing the output inside the actual test file. Really considering doing this soon though, because it would be the perfect baseline for a lot of other testing possibilities I have in mind…

@spatie-bot
Copy link

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.

@dylanbr
Copy link
Author

dylanbr commented May 30, 2024

@sebastiandedeyne I am still very much interested in having this feature, but I'm unable to re-open the issue.

Please would you consider re-opening it so that it does not get buried.

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

3 participants