fix: map test failure to correct line with latest Vitest #111
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Happy Holidays 馃巹!
Starting Vitest 0.25.x, Vitest started doing sourcemaps differently and stopped sending the parsed
stacks
as part of the api that this plugin uses to communicate with it.As a result, test failure would be incorrectly mapped in the UI:
Screen.Recording.2022-12-25.at.15.54.09.mov
I've openned a PR in Vitest that fixes this and sends stacks again.
However that PR in Vitest isn't enough by itself. Vitests used to include
sourcePos
(the sourcemapped position of the error) in theParsedStack
, but as stacks are now always source mapped, @sheremet-va pointed out this didn't make sense anymore and we removed it.This PR catters for the case where Vitest does sends the stacks, but doesn't send
sourcePos
, which will be the case as soon as the PR on Vitest side is released.With both the Vitest PR and this PR in, the extension is now behaving as intended and point to the line where the test failure occurs:
Screen.Recording.2022-12-25.at.15.18.19.mov