On Windows, when a test fails and vitest.applyDiagnostic is enabled, the extension does not show a squiggly underline on the failing line in the editor.
The test still shows as failed in the Testing panel, and the failure overlay appears when you click it. But there is no inline diagnostic squiggle, and the failure often does not show up in the Problems panel either.
In the Vitest output channel, the extension logs something like:
Could not find a valid stack for <test name> [...]
[DECOR] Reset all decorations
The stack trace in that log looks correct (it has the right file path and line number). The extension just fails to match it to the test file.
I plan to submit a PR with a fix.
Expected behavior
When a test fails on Windows, I expect a red squiggle on the failing line (usually the expect(...) line), the same way it works on macOS/Linux and the same way TypeScript/ESLint errors show squiggles.
Reproduction
- Use Windows with the Vitest extension installed.
- Open any project with Vitest tests.
- Make sure
"vitest.applyDiagnostic": true is set (this is the default).
- Run a test from the Testing panel (beaker icon), not from the terminal.
- Use a test that fails on purpose, e.g. change
expect(x).toBe(1) to expect(x).toBe(2).
Result: Test shows as failed, but no squiggle on the failing line.
Root cause: In parseLocationFromStacks (packages/extension/src/runner.ts), the stack file path is normalized with normalizeDriveLetter() (e.g. C:\...), but testItem.uri.fsPath is compared as-is. On Windows, VS Code uses a lowercase drive letter (c:\...). The strict === comparison fails even though both paths point to the same file.
Workaround: Patching the installed extension so parseLocationFromStacks also runs normalizeDriveLetter() on testItem.uri.fsPath makes squiggles appear after reload.
Output
Could not find a valid stack for should return 1 [
{
"method": "",
"file": "C:/git/my-project/__tests__/example.test.ts",
"line": 28,
"column": 20
}
]
[DECOR] Reset all decorations
Extension Version
1.50.6
Vitest Version
Any recent version (tested with Vitest 3.x)
On Windows, when a test fails and
vitest.applyDiagnosticis enabled, the extension does not show a squiggly underline on the failing line in the editor.The test still shows as failed in the Testing panel, and the failure overlay appears when you click it. But there is no inline diagnostic squiggle, and the failure often does not show up in the Problems panel either.
In the Vitest output channel, the extension logs something like:
The stack trace in that log looks correct (it has the right file path and line number). The extension just fails to match it to the test file.
I plan to submit a PR with a fix.
Expected behavior
When a test fails on Windows, I expect a red squiggle on the failing line (usually the
expect(...)line), the same way it works on macOS/Linux and the same way TypeScript/ESLint errors show squiggles.Reproduction
"vitest.applyDiagnostic": trueis set (this is the default).expect(x).toBe(1)toexpect(x).toBe(2).Result: Test shows as failed, but no squiggle on the failing line.
Root cause: In
parseLocationFromStacks(packages/extension/src/runner.ts), the stack file path is normalized withnormalizeDriveLetter()(e.g.C:\...), buttestItem.uri.fsPathis compared as-is. On Windows, VS Code uses a lowercase drive letter (c:\...). The strict===comparison fails even though both paths point to the same file.Workaround: Patching the installed extension so
parseLocationFromStacksalso runsnormalizeDriveLetter()ontestItem.uri.fsPathmakes squiggles appear after reload.Output
Extension Version
1.50.6
Vitest Version
Any recent version (tested with Vitest 3.x)