Describe the bug
When using Vite+ test imports, third-party Vitest type augmentations do not apply because the module specifiers differ from vitest and vitest/browser.
I have a small demo repo as a reproduction. In this repo I get type errors for the test/repro.browser.test.ts file.
Reproduction
https://github.com/joknoll/vite-plus-vitest-type-aug
Steps to reproduce
Running vp check results in these errors:
× typescript(TS2339): Property 'render' does not exist on type 'BrowserPage'.
╭─[tests/browser/repro.browser.test.ts:7:29]
6 │ test("reproduces missing Vite+ type augmentations", async () => {
7 │ const screen = await page.render(Repro, { label: "hello" });
· ──────
8 │
╰────
× typescript(TS2339): Property 'element' does not exist on type 'ExpectStatic'.
╭─[tests/browser/repro.browser.test.ts:9:16]
8 │
9 │ await expect.element(screen.getByRole("heading", { name: "hello" })).toBeVisible();
· ───────
10 │ });
╰────
System Info
Environment:
Version 24.14.1
Source lts
Tool Paths:
node /home/hannes/.vite-plus/js_runtime/node/24.14.1/bin/node
npm /home/hannes/.vite-plus/js_runtime/node/24.14.1/bin/npm
npx /home/hannes/.vite-plus/js_runtime/node/24.14.1/bin/npx
Used Package Manager
pnpm
Logs
Validations
Describe the bug
When using Vite+ test imports, third-party Vitest type augmentations do not apply because the module specifiers differ from vitest and vitest/browser.
I have a small demo repo as a reproduction. In this repo I get type errors for the
test/repro.browser.test.tsfile.Reproduction
https://github.com/joknoll/vite-plus-vitest-type-aug
Steps to reproduce
Running
vp checkresults in these errors:System Info
Used Package Manager
pnpm
Logs
Validations