Skip to content

@vitest/browser-playwright types incompatible with defineConfig due to bundled vitest copy #1634

@kotkoroid

Description

@kotkoroid

Describe the bug

Configuring Vitest browser mode through vite-plus's defineConfig fails to type-check when the provider is set to playwright() imported from @vitest/browser-playwright.

@voidzero-dev/vite-plus-test bundles its own copy of vitest internals (currently 4.1.5) inside its dist/, and declares @vitest/browser-playwright only as a devDependency rather than a peerDependency. When a downstream project installs @vitest/browser-playwright directly (e.g. via bun add), two structurally-identical but nominally-distinct copies of the vitest type tree end up loaded. TypeScript trips on private fields like _clearScreenPending and reports a long incompatibility chain ending in Types have separate declarations of a private property '_clearScreenPending'.

Runtime is fine — tests execute and pass. The bug is purely a types/packaging mismatch.

Reproduction

https://github.com/kotkoroid/vite-plus-vitest-browser-types-repro

Steps to reproduce

bun run check runs tsc --noEmit and produces the type error chain ending in:

Types have separate declarations of a private property '_clearScreenPending'.

bun run test succeeds — the failure is purely at the type level.

System Info

VITE+ - The Unified Toolchain for the Web

vp v0.0.0

Local vite-plus:
  vite-plus  v0.1.20

Tools:
  vite             v8.0.10
  rolldown         v1.0.0-rc.17
  vitest           v4.1.5
  oxfmt            v0.46.0
  oxlint           v1.61.0
  oxlint-tsgolint  v0.22.0
  tsdown           v0.21.10

Used Package Manager

bun

Logs

Validations

Metadata

Metadata

Assignees

Type

Priority

None yet

Effort

None yet

Target date

None yet

Start date

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions