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

Automatic stdout/stderr assertion updates #1853

Merged
merged 1 commit into from
Apr 3, 2024
Merged

Conversation

kddnewton
Copy link
Contributor

When I was working on the ripper compiler, I found it difficult to have to update every single assertion that is assertion against stdout/stderr of tapioca. Because it's not assertion against a subset, any change to the logic will cause the entire test to fail and have to be updated.

These are more like snapshot tests than unit tests. Therefore I built a way to update all of the snapshots in one go. It's not meant to be comprehensive or even tested, but I found it very useful as opposed to trying to update every fixture myself, so I figured I would upstream it in case there was interest.

You trigger it by running the test suite with TAPIOCA_ASSERTIONS_UPDATE=1. You can see how it works by — for example — changing "Loading DSL extension classes... " to something else, running TAPIOCA_ASSERTIONS_UPDATE=1 bin/test spec/tapioca/cli/dsl_spec.rb, and seeing how everything changes.

@kddnewton kddnewton requested a review from a team as a code owner March 29, 2024 19:03
@kddnewton kddnewton requested review from andyw8 and st0012 March 29, 2024 19:03
@kddnewton kddnewton added the enhancement New feature or request label Mar 29, 2024
@andyw8 andyw8 requested review from Morriar and KaanOzkan and removed request for andyw8 April 2, 2024 16:16
When I was working on the ripper compiler, I found it difficult to
have to update every single assertion that is assertion against
stdout/stderr of tapioca. Because it's not assertion against a
subset, any change to the logic will cause the entire test to fail
and have to be updated.

These are more like snapshot tests than unit tests. Therefore I
built a way to update all of the snapshots in one go. It's not
meant to be comprehensive or even tested, but I found it very
useful as opposed to trying to update every fixture myself, so I
figured I would upstream it in case there was interest.
@KaanOzkan KaanOzkan force-pushed the update-assertions branch from 88e1a38 to 48f7586 Compare April 3, 2024 14:22
@KaanOzkan KaanOzkan merged commit e7cf9f1 into main Apr 3, 2024
35 checks passed
@KaanOzkan KaanOzkan deleted the update-assertions branch April 3, 2024 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants