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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: map test failure to correct line with latest Vitest #111

Conversation

adrienbaron
Copy link
Contributor

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 the ParsedStack, 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

@adrienbaron adrienbaron changed the title fix: map error to correct position when no sourcePos fix: map test failure to correct line with latest Vitest Dec 26, 2022
@zxch3n
Copy link
Member

zxch3n commented Dec 29, 2022

Thanks for looking into this!

@zxch3n zxch3n merged commit 6ce8110 into vitest-dev:main Dec 29, 2022
@adrienbaron adrienbaron deleted the fix/using-position-in-stacks-when-no-sourcepos branch December 29, 2022 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants