You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor!: replace @voidzero-dev/vite-plus-test with upstream vitest (#1588)
## Summary
Deletes the bundled `@voidzero-dev/vite-plus-test` wrapper and consumes
upstream `vitest@4.1.5` (plus `@vitest/browser*`) directly. The vite
redirection role that drove the wrapper is now handled cleanly by
package-manager overrides (`vite` → `@voidzero-dev/vite-plus-core`), so
the bundle was dead weight that lagged upstream releases.
**Public API contract preserved:**
- `vite-plus/test*` IS the public test API — existing user code (`import
{ vi } from 'vite-plus/test'`, etc.) is NEVER rewritten.
- New vite-plus users don't install `vitest` or `@vitest/*` separately;
they come in transitively as direct deps of `vite-plus`.
- `vp migrate` on an upstream-vitest project still forward-migrates
`vitest`, `vitest/*`, `@vitest/browser*`, declare-module specifiers, and
`/// <reference types>` directives to the `vite-plus/test*` surface
(one-time transition).
**Notable changes:**
- `packages/cli/build.ts`: `syncTestPackageExports` auto-generates
`./test/*` shims from upstream `vitest`'s exports map, plus
`./test/<provider>` and `./test/browser/providers/<short>` shims
projected from each `@vitest/browser-*` package's exports.
- `packages/cli/package.json`: adds `@vitest/browser`,
`@vitest/browser-playwright`, `@vitest/browser-preview`,
`@vitest/browser-webdriverio` as direct catalog deps pinned to `4.1.5`.
- `crates/vite_global_cli/src/commands/version.rs`: vitest ToolSpec
points at the `vitest` package directly.
- `packages/cli/src/resolve-test.ts`: resolves `vitest/package.json` and
reads `bin.vitest` so `vp test` invokes upstream vitest.
- `packages/cli/src/utils/constants.ts`: drops `vitest` from
`VITE_PLUS_OVERRIDE_PACKAGES`; only `vite` remains a managed key.
- `packages/cli/src/migration/migrator.ts`:
- Adds an `isVitestAdjacent` flag that flips `needVitePlus = true` for
projects with packages like `vitest-browser-svelte` even when there's no
vite/oxlint/tsdown to migrate.
- Adds `pruneLegacyWrapperAliases` / `pruneYamlMapLegacyWrapperAliases`
sweeps that rewrite stale `vitest: npm:@voidzero-dev/vite-plus-test@*`
aliases to `^4.1.5` (so existing `catalog:` refs keep resolving) and
drop other stale wrapper-targeted keys.
- `packages/cli/src/migration/bin.ts`: adds a `handleInstallResult`
helper so failed reinstalls warn the user, append to `report.warnings`,
and flip `process.exitCode` instead of being silently reported as
success.
## User-visible behavior changes
`vp test -h` and live test runs now show vitest's native banner
(`vitest/<semver>`, ` RUN v<semver> <cwd>`) instead of the
wrapper-rebranded output (`vp test/<semver>`, ` RUN <cwd>`). This is the
tradeoff for delegating directly to upstream vitest without a wrapper
layer.
## Test plan
- [x] `cargo test -p vite_migration --lib`: 167 tests pass
- [x] `pnpm exec vitest run` (packages/cli): 374 tests pass
- [x] `pnpm bootstrap-cli` succeeds
- [x] `pnpm -F vite-plus snap-test-global` + `snap-test-local`: all
fixtures regenerated; diffs only reflect expected behavior (forward
import rewrites, `@vitest/browser*` removed from user devDeps,
`playwright`/`webdriverio` preserved as peers, stale `vite-plus-test`
catalog aliases normalized to `^4.1.5`).
- [ ] Manual end-to-end: `vp test` on a fixture using `import { vi }
from 'vite-plus/test'`; `vi.mock(...)`. See "Follow-up" below.
- [ ] Manual end-to-end: `vp migrate` on a fresh upstream-vitest
project.
- [ ] `pnpm install` clean: zero `@voidzero-dev/vite-plus-test`
references in the lockfile, browser-provider packages installed
transitively via `vite-plus`.
## Follow-up
- vitest-dev/vitest#10489
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Touches release/publish paths, daily dep bumps, and CI override
behavior for all package managers (especially Bun peer resolution).
Public migration guidance and version reporting change, but the
`vite-plus/test*` import surface stays the same.
>
> **Overview**
> Removes **`@voidzero-dev/vite-plus-test`** from release, pkg.pr.new,
and CI pack flows, and stops bumping **`packages/test`** in
**`upgrade-deps`** and prepare-release. Vitest is now tracked as
upstream **`vitest`** with catalog **`@vitest/*`** entries kept on the
same exact version.
>
> **Dependency automation** rewrites **`VITEST_VERSION`**,
**`test-vp-create`** override pins, and README manual-migration
**`vitest`** literals (exact semver instead of
**`npm:@voidzero-dev/vite-plus-test@latest`**).
**`pnpm-workspace.yaml`** matching switches from the old
**`vitest-dev`** alias to a plain **`vitest:`** catalog line.
>
> **CI packaging** pins **`core`/`cli`** to **`0.0.0`** for stable tgz
names, drops the test package tarball, and adds **`repack-vite-tgz`** so
Bun smoke/e2e can satisfy Vitest’s **`peer vite`** via a masqueraded
**`vite-7.99.0.tgz`**. **`vp create`** tests override
**`vitest`/`@vitest/*`** by version instead of a local test tgz.
>
> **User-facing docs and CLI**: README explains pinning bundled Vitest
for a single copy with **`vp test`**. **`vp --version`** resolves Vitest
from the **`vitest`** package. Migration file walking adds
**`.cjs`/`.cts`** for reverse **`require('vite-plus/test/...')`**
rewrites.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
9b59731. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
0 commit comments