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
Fix test retries that contain snapshots #8019
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm down with this approach :)
event.test.errors = []; | ||
|
||
// Clear any snapshot data that occurred in previous test run | ||
const tmpSnapshotState = global.expect.getState().snapshotState; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would make sense for global.expect
to expose clearState
, call it here and let it do the job of cleaning up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally agree. I should have some time this week to look at this some more.
Feel free to adapt testing approach from #8015 |
is this really the right fix? if I have tests The right solution would be to reset the snapshot not from scratch, but from after |
@itajaja this is a work in progress PR as the heading makes clear. I'll be taking a look at this again this week. |
sounds good. thanks for looking into this 👍 |
Any updates about this? |
Hi @palmerj3 👋! Do we have an update on this by any chance? I'm also happy to take over this PR if needed. |
|
||
if (tmpSnapshotState) { | ||
if ( | ||
tmpSnapshotState._snapshotPath && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! Please feel free to work on it :) It's all of our code not my code.
Ultimately the issue this PR tries to fix is the fact that a snapshot file for a test will contain n-copies depending on how many times it's rerun. So this was one way we could fix that by removing the snapshot file before new data is written.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! I'll keep working on it and update the PR once I have something 😄
Closed by #8629 |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
WIP DO NOT MERGE
This is an exploratory PR to solve the problem of snapshot data being written multiple times when tests are retried.
Fixes #7493
Closes #8015
Test plan
Nothing at the moment aside from the existing test suite. Collecting feedback with this PR on the approach.