-
Notifications
You must be signed in to change notification settings - Fork 157
vite-plus/test module identities break vitest type augmentations #1256
Copy link
Copy link
Labels
bugSomething isn't workingSomething isn't working
Description
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/npxUsed Package Manager
pnpm
Logs
Validations
- Read the Contributing Guidelines.
- Check that there isn't already an issue for the same bug.
- Confirm this is a Vite+ issue and not an upstream issue (Vite, Vitest, tsdown, Rolldown, or Oxc).
- The provided reproduction is a minimal reproducible example.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Fields
Give feedbackPriority
None yet
Effort
None yet
Target date
None yet
Start date
None yet