You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When AVA is passed --update-snapshots and a test runner encounters a skip()ed test (or, with #2623, a skip()ed assertion) the reporter prints "Could not update snapshots for the following test files: <list of filenames>".
This message doesn't say why snapshots couldn't be updated. In practice the reason is likely to be divinable (the user just recently added a .skip()), but it could be a lot clearer.
Further, the message can appear for test files that never use snapshots and test files where all snaphots match. It doesn't mean much of anything in these cases, and could mislead the user into thinking something went wrong.
How AVA could handle this
Indicating a reason: The Runner should know what problem prevented updating. It would have to pass this reason back with its {cannotSave: true} result from Runner#saveSnapshotState(), and then this would be propagated along though the 'snapshot-error' event and handled by reporters.
Suppressing the message when not relevant: checking whether snapshots existed should be simple enough. checking whether snapshots changed is trickier. The snapshot manager would have to be queried about whether any snapshots failed to match, which isn't currently something it knows when run in updating mode, since it ignores the .snap file entirely in favor of regenerating it.
This issue would benefit from reworking the snapshot manager to check for and load snapshots in every run, instead of only when it's called for and only when not updating.
The text was updated successfully, but these errors were encountered:
What you're trying to do:
When AVA is passed
--update-snapshots
and a test runner encounters askip()
ed test (or, with #2623, askip()
ed assertion) the reporter prints "Could not update snapshots for the following test files: <list of filenames>".This message doesn't say why snapshots couldn't be updated. In practice the reason is likely to be divinable (the user just recently added a
.skip()
), but it could be a lot clearer.Further, the message can appear for test files that never use snapshots and test files where all snaphots match. It doesn't mean much of anything in these cases, and could mislead the user into thinking something went wrong.
How AVA could handle this
Indicating a reason: The
Runner
should know what problem prevented updating. It would have to pass this reason back with its{cannotSave: true}
result fromRunner#saveSnapshotState()
, and then this would be propagated along though the'snapshot-error'
event and handled by reporters.Suppressing the message when not relevant: checking whether snapshots existed should be simple enough. checking whether snapshots changed is trickier. The snapshot manager would have to be queried about whether any snapshots failed to match, which isn't currently something it knows when run in
updating
mode, since it ignores the.snap
file entirely in favor of regenerating it.This issue would benefit from reworking the snapshot manager to check for and load snapshots in every run, instead of only when it's called for and only when not
updating
.The text was updated successfully, but these errors were encountered: