Open lydell opened 2 months ago
toMatshSnapshot
is known to have an issue with retry
https://github.com/vitest-dev/vitest/issues/5312, but the recent validation made retry
not work with toMatshInlineSnapshot
as well (though technically there was an issue with retry
and toMatshInlineSnapshot
in some cases).
Both could be fixed by the same approach mentioned in https://github.com/vitest-dev/vitest/issues/5312#issuecomment-2176222629
Describe the bug
When you use the
--retry=n
flag (wheren > 0
), inline snapshots that succeeded on the first try fail on the retries withtoMatchInlineSnapshot cannot be called multiple times at the same location
. This means that if you precede a flaky assertion with an inline snapshot, the--retry
flag does not work.It sounds like the some state that
toMatchInlineSnapshot
carries needs to be reset between retries.I later learned that
--retry=1
is enough – it’s the number of retries not the number of total tries.Reproduction
https://github.com/lydell/vitest-inline-snapshot-retry
System Info
Used Package Manager
npm
Validations