refactor: replace @voidzero-dev/vite-plus-test with upstream vitest@4.1.5#1588
refactor: replace @voidzero-dev/vite-plus-test with upstream vitest@4.1.5#1588Brooooooklyn wants to merge 77 commits into
Conversation
✅ Deploy Preview for viteplus-preview canceled.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 365a61de42
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…mat/typo PR #1588 CI failures: - Force-override mode (VP_FORCE_MIGRATE=1, set by test-vp-create.yml and ecosystem-ci) now re-pins any pre-existing vite-plus range to the local tgz path in monorepo workspace packages. Without this, pnpm reads the published vite-plus@0.1.21 metadata to resolve transitive deps including @voidzero-dev/vite-plus-test@0.1.21, which shadowed upstream vitest@4.1.5 at runtime and broke vp create monorepo tests. - typos CI: rename yarn-PnP to yarn Plug'n'Play (Pn→On false positive). - vp check: format packages/cli/build.ts shim-generation block. - Rename __dirname in install-failure-guard.spec.ts to satisfy eslint(no-underscore-dangle).
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4fafa67971
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ec69abaadb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 381b6e2c20
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…mat/typo PR #1588 CI failures: - Force-override mode (VP_FORCE_MIGRATE=1, set by test-vp-create.yml and ecosystem-ci) now re-pins any pre-existing vite-plus range to the local tgz path in monorepo workspace packages. Without this, pnpm reads the published vite-plus@0.1.21 metadata to resolve transitive deps including @voidzero-dev/vite-plus-test@0.1.21, which shadowed upstream vitest@4.1.5 at runtime and broke vp create monorepo tests. - typos CI: rename yarn-PnP to yarn Plug'n'Play (Pn→On false positive). - vp check: format packages/cli/build.ts shim-generation block. - Rename __dirname in install-failure-guard.spec.ts to satisfy eslint(no-underscore-dangle).
5c48da8 to
39efcbf
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 39efcbf239
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2fceee5296
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b888329d76
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Upstream blockers (still needed after the fixes in this PR)
|
Upstream blockers (updated)After the latest fixes (
|
Final status (after b6b5b8b)The aggressive Rust source-rewrite in 21937c5 (which made Confirmed upstream blockers:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b6b5b8b0bf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 60b7d0f0ac
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Final status — branch HEAD 3ffb7cdE2E now at expected steady state. The two remaining upstream items:
Everything else (npmx.dev, vinext, vue-mini, frm-stack, varlet, vitepress, reactive-resume, rollipop, dify, etc.) is now green. |
…mat/typo PR #1588 CI failures: - Force-override mode (VP_FORCE_MIGRATE=1, set by test-vp-create.yml and ecosystem-ci) now re-pins any pre-existing vite-plus range to the local tgz path in monorepo workspace packages. Without this, pnpm reads the published vite-plus@0.1.21 metadata to resolve transitive deps including @voidzero-dev/vite-plus-test@0.1.21, which shadowed upstream vitest@4.1.5 at runtime and broke vp create monorepo tests. - typos CI: rename yarn-PnP to yarn Plug'n'Play (Pn→On false positive). - vp check: format packages/cli/build.ts shim-generation block. - Rename __dirname in install-failure-guard.spec.ts to satisfy eslint(no-underscore-dangle).
3ffb7cd to
a0d248e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a0d248e65e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a5b2697e5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
`replaceInstalledCheckoutPackages` symlinked `node_modules/vitest` and `node_modules/@voidzero-dev/vite-plus-test` to `packages/test`, which this branch deletes. The entries are never matched by the current snap suite (only `create-framework-shim-vue` sets `linkCheckoutPackages` and it installs neither package), but a future global snap test that does install vitest would `rmSync` the real package and symlink it to the now-missing `packages/test`. Remove both stale entries. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
`pnpm pkg set` is not implemented (ERR_PNPM_NOT_IMPLEMENTED); pnpm points to the npm CLI for `pkg` operations. Switch the version pin in the tgz pack steps to `npm pkg set version=0.0.0`. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The ecosystem-ci pack step pins packages/cli to 0.0.0 before packing, so the installed local build reports 0.0.0. verify-install.ts still compared against the committed packages/cli/package.json version (0.1.22 after the release bump), failing every ecosystem E2E project with "expected version 0.1.22, got 0.0.0". Pin the expected version to 0.0.0, matching the fixed `vite-plus-0.0.0.tgz` that patch-project.ts references. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
`externalDtsTypeOnlyPlugin` blindly prepended `import type ` to every
import line in postcss/lightningcss `.d.ts` files. For the
`import D, { N } from 'x'` shape that produced `import type D, { N }`,
which is invalid — a type-only import statement cannot mix a default
binding with named bindings. The dts bundler then failed with
`[PARSE_ERROR]` (surfaced by the `vp-config` ecosystem-ci project,
whose dependency graph routes postcss's `.d.ts` through this plugin).
Fold the default binding into the named clause as `{ default as D, N }`
before the generic prepend, in both the internal-file and
consumer-file branches.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
`vp pack --dts` inlined postcss's `.d.ts` into the declaration bundle
and failed with 61 MISSING_EXPORT errors for postcss type names.
postcss exposes its public types via `declare namespace postcss {
export {...} }` + `export = postcss` — a CJS namespace shape the dts
bundler cannot map named imports onto.
`externalDtsTypeOnlyPlugin` previously rewrote postcss/lightningcss
imports to type-only via regex, which neither parsed reliably for
default+named imports nor addressed the `export =` mismatch. Replace
it with a `resolveId` hook that marks postcss/lightningcss external
whenever imported from a `.d.ts` file, so emitted declarations keep
`import type { X } from 'postcss'` instead of inlining postcss's
`.d.ts` — standard dts-bundler treatment of third-party packages.
Runtime bundling is unaffected (the hook only fires for
declaration-file importers).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The daily upgrade script bumped the vitest catalog, VITEST_VERSION, and the test-vp-create.yml pins, but never touched the @vitest/mocker entry in patchedDependencies. pnpm keys patchedDependencies by exact version and fails ERR_PNPM_PATCHED_PKG_DOES_NOT_MATCH on drift, so each vitest bump broke the auto-upgrade PR. Rewrite the key + patch path and rename the version-suffixed patch file as part of the upgrade run. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
`vitest@4.1.7`'s dist/index.d.ts re-exports `ExpectPollOptions` from `@vitest/expect`, which does not export that name. tsc tolerates the dangling re-export (lazy resolution) but the rolldown dts bundler resolves every re-export eagerly while inlining, so `vp pack --dts` fails with MISSING_EXPORT. Extend externalDtsTypeOnlyPlugin to keep vitest and @vitest/* external for .d.ts importers, the same treatment already applied to postcss/lightningcss. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
vitest browser mode injects `optimizeDeps.include` entries like `vitest > expect-type` that Vite resolves from the config root. In a pnpm strict (non-hoisted) layout, a `vitest` pulled in only transitively via `vite-plus` is not resolvable from the package directory, so the optimizer fails and the browser test page hangs forever — this broke the `vibe-dashboard` E2E job across the whole branch. `vp migrate` now detects vitest browser mode (recursive scan for `@vitest/browser` / `vite-plus/test/browser` specifiers, stopping at nested package.json boundaries) and adds `vitest` as a direct devDependency so pnpm hoists it next to the package. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ch sync
- Switch `replace('/', '\\/')` to `replaceAll` in both regex builders so a
future vitest sub-key with multiple slashes can't silently produce a
broken pattern.
- Always persist `updateVitestMockerPatch`'s in-memory rewrite when the
content changed, not only when the key version moved — fixes a case
where the key already matches `vitestVersion` but the value's patch-file
suffix is stale, which would otherwise leak through and trigger
ERR_PNPM_PATCHED_PKG_DOES_NOT_MATCH on install.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
… PnP - Regenerate pnpm-lock.yaml after rebase onto main so the catalog configuration matches; without this `pnpm install --frozen-lockfile` errors with ERR_PNPM_LOCKFILE_CONFIG_MISMATCH in CI. - Add `PnP` (Yarn Plug'n'Play) to .typos.toml so the new migrator comment doesn't trip the typos linter (Pn -> On false positive). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…thin-space WARN
- sync-remote-deps.ts: the patchedDependencies merge previously reset
result.patchedDependencies = {} before copying vite's patches, which
dropped any vite-plus root-level patches (notably the new
@vitest/mocker@4.1.7 patch added on this branch) on every sync. Seed
the merge from main.patchedDependencies so root patches survive.
- utils.ts: the pnpm warning scrub patterns only matched an ASCII space
before `WARN`, but pnpm output frequently prefixes warnings with a
U+2009 thin space; broaden the prefix class to `[ ]?` for the
Skip-adding, Request-took, registry GET, and Tarball patterns.
- pnpm-lock.yaml: regenerate against the now-pinned rolldown@f2757ed7
clone (where @rolldown/pluginutils is a `catalog:` dep instead of a
`workspace:*` package), fixing the ERR_PNPM_OUTDATED_LOCKFILE that
was tanking every CI job after the rebase.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…plugin
`prefer-vite-plus-imports` previously autofixed `TSModuleDeclaration` string
literals like `declare module '@vitest/browser-playwright' { ... }` to
`declare module 'vite-plus/test/browser-playwright' { ... }`. That contradicts
`vp migrate`'s deliberate behavior (and the migration guide's instructions)
of preserving `declare module 'vitest'` / `declare module '@vitest/browser*'`
on the upstream identity so type augmentations merge with what
`vite-plus/test*` actually re-exports. `vp lint --fix` could therefore undo
the augmentation targets users had just been told to keep.
Skip the rewrite in the `TSModuleDeclaration` visitor when the literal is in
the vitest/@vitest-browser family; `declare module 'vite'` and other
non-vitest specifiers continue to be rewritten as before.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…are-module fix - typos: `extend-words` matches whole identifiers via the tokenizer, but `PnP` is split into the word `Pn` (which typos wants to autocorrect to `On`), so the previous entry didn't apply. Move to `extend-identifiers` so the full token is whitelisted. - snap-tests/lint-vite-plus-imports: reflect the oxlint plugin change from 42beb51 — `declare module '@vitest/browser-playwright'` and `declare module '@vitest/browser-playwright/context'` are no longer reported (7 errors → 5) and `vp lint --fix` no longer rewrites them in src/types.ts. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
`pnpm dedupe --check` in the Lint workflow flagged duplicate resolutions in the regenerated lockfile from 52577b1037. Run `pnpm dedupe` to consolidate them (e.g. yaml 2.8.2/2.9.0 split in packages/cli) and clear ERR_PNPM_DEDUPE_CHECK_ISSUES on CI. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The file walker visits `.cjs` / `.cts` files, but the ast-grep rewrite
rules only matched `inside: { kind: import_statement }` and
`kind: module`. That left `require('vitest')`, `require('vitest/config')`,
`require('@vitest/browser*')`, `require('vite')`, and `require('tsdown')`
unrewritten in CommonJS configs like `vitest.config.cjs`, even when
sibling ESM files in the same project were migrated — producing mixed
specifiers and resolution failures.
Mirror every existing import-statement rule with a require-shape sibling
that matches `inside: { kind: arguments, inside: { kind: call_expression,
has: { field: function, regex: ^require$ } } }`. The callee anchor keeps
`my_require(...)`, `require.cache[...]`, `require.resolve(...)`, and
dynamic `import(...)` correctly out of scope. `declare module` (`kind:
module`) is intentionally not mirrored — CJS has no equivalent.
19 new require-shape rules (vite ×2, vitest family ×15, tsdown ×2) and
25 new tests covering positive rewrites + negative cases (my_require,
require.cache, require.resolve) + skip_packages parity.
`cargo test -p vite_migration --lib`: 212 passed, 0 failed.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The push of e34f1c5 happened during a GitHub Actions outage and the synchronize event was lost — only third-party checks fired. Empty commit to force a fresh pull_request synchronize so the main CI / E2E / Test vp create workflows enqueue. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
CI's Lint→Deduplicate step caught another mismatch where rolldown-plugin-dts had two peer-resolved variants in the lockfile (one with `oxc-resolver`, one without). The previous local dedupe ran before this drift surfaced; rerun resolves it. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sibling rules for every `inside: { kind: import_statement }` rule now
also match `kind: export_statement`, so `export { page } from
'@vitest/browser/context'`, `export * from '@vitest/browser-playwright'`,
`export * as ns from 'vitest'`, and `export type { Config } from
'vitest/config'` are rewritten the same way as their `import` siblings.
Without this, projects with barrel files re-exporting from `@vitest/*`
were left pointing at packages that `rewritePackageJson()`
(`REMOVE_PACKAGES`) had already dropped from package.json — hitting
ERR_PACKAGE_PATH_NOT_EXPORTED under strict pnpm / yarn PnP layouts.
19 new export-statement rules mirroring all existing import rules
(vite ×2, vitest family ×15, tsdown ×2). 10 new tests across all four
`export_statement` shapes plus a negative test that a string literal
outside an export-from is left alone. `cargo test -p vite_migration
--lib`: 222 passed (was 212).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The 10 new tests added in 0b1de50 used multi-line `assert_eq!` blocks that rustfmt prefers as single-line. CI's rustfmt-check caught the drift. No behavior change. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The prior `REQUIRE_PATTERN` regex used a lookbehind that matched a
newline+whitespace boundary, which also matched inside multi-line
template literals — so fixture or snapshot strings containing
`require('vite-plus/test')` were mutated to `require('vitest')` even
though they were not real require calls.
Replace the regex with an `oxc-parser` walk that only edits string
arguments of `CallExpression` nodes whose callee is the plain
`Identifier "require"`. Template literals, string literals, JSX text,
and `.require(...)` member calls are all distinct AST nodes and stay
untouched. On parser bailout the source is returned unchanged — we no
longer fall back to a regex on raw user code.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…e specifiers
The existing rewrite rules covered `import_statement`, `export_statement`,
and `require()` call shapes but did not cover dynamic `import('...')` or
TS type-position `typeof import('...')`. Since `rewritePackageJson()`
removes `@vitest/browser*` from the user's deps post-migration, untouched
dynamic imports broke at runtime under pnpm strict / Yarn PnP layouts.
Add a `*-dynamic-import` sibling for every existing `*-require` rule
(19 families total), matching `call_expression` nodes whose function
field is the special `import` token — the same AST shape covers both
dynamic `import('x')` and `typeof import('x')` in tree-sitter-typescript.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The pre-refactor `@voidzero-dev/vite-plus-test` wrapper exposed `./test/plugins/<name>` subpaths (one per `@vitest/*` package and subpath). Replacing the wrapper with upstream `vitest@4.1.7` dropped those entries — a breaking change for users that imported from `vite-plus/test/plugins/*`. Reinstate the surface by extending syncTestPackageExports() with a PLUGIN_SHIM_ENTRIES table and a small loop that delegates to createShimForExport. Each shim is a one-line `export * from '@vitest/<x>'` re-export. The old `utils-highlight` entry is dropped — @vitest/utils@4.1.7 removed `/highlight` from its exports map. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The constant declaration's comment already explains why the loop exists. Restating it at the loop site is noise — the reviewer flagged it during code review. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
CI lint failed because the recent dynamic-import tests in import_rewriter.rs used a multi-line `assert_eq!` form that rustfmt collapses to single-line, and oxfmt flagged the `PLUGIN_SHIM_ENTRIES` type annotation in build.ts plus a test file in define-config-mocker-rewrite.spec.ts. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Reading `vitest/package.json` is a metadata-access pattern (typically to fetch the vitest version). The catch-all `vitest/*` rule was rewriting it to `vite-plus/test/package.json`, which fails with ERR_PACKAGE_PATH_NOT_EXPORTED because syncTestPackageExports() explicitly skips the upstream `./package.json` entry. Exclude `vitest/package.json` from all four rewrite shapes (import, export, require, dynamic-import). The original specifier still resolves at runtime through the transitively-installed vitest dep. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Rebase onto origin/main (oxc 0.132→0.133, oxlint 1.66→1.67, oxfmt 0.51→0.52). Lockfile conflict resolved by taking main's side and regenerating with pnpm install to pick up the refactor's package.json deltas (direct vitest@4.1.7 + @vitest/browser-* deps, removed @voidzero-dev/vite-plus-test override). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The browser-mode detector only inspected user source for `@vitest/browser*` imports. Users who enable browser mode via `vite.config.ts` only (e.g. `test.browser.provider: 'playwright'`) list `@vitest/browser-playwright` in devDependencies but never `import` from it. After migration, `rewritePackageJson` removed those deps without adding a direct `vitest` dep — breaking vitest resolution under pnpm strict / Yarn PnP. Add a second signal: any `@vitest/browser*` package in the original deps before rewrite triggers browser-mode. The source-scan stays as a fallback for edge cases where browser mode is configured but the provider package isn't installed yet. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
f791106 to
80b0268
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 80b0268. Configure here.
| import { join } from 'node:path'; | ||
|
|
||
| import cliPkg from '../packages/cli/package.json' with { type: 'json' }; | ||
| import { VITEST_VERSION } from '../packages/cli/src/utils/constants.ts'; |
There was a problem hiding this comment.
Ecosystem CI tgz path uses stale version after pinning
High Severity
vitePlusTgz is constructed from cliPkg.version (currently 0.1.22), producing a path like vite-plus-0.1.22.tgz. But the e2e workflow's build job now pins packages/cli to 0.0.0 before pnpm pack, so the actual artifact is vite-plus-0.0.0.tgz. The e2e-test job checks out the repo fresh (without the pin), so vpVersion resolves to the original version, referencing a file that doesn't exist. This breaks every ecosystem-ci project's vp migrate and vp install steps.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 80b0268. Configure here.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 80b0268507
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for (const pkg of AUTO_INLINE_DEPS) { | ||
| if (!merged.some((entry) => entry === pkg || (entry instanceof RegExp && entry.test(pkg)))) { | ||
| merged.push(pkg); | ||
| } |
There was a problem hiding this comment.
Avoid auto-inlining absent matcher packages
For projects that use defineConfig but do not install one or more of these optional matcher libraries, this unconditionally adds bare package names to test.server.deps.inline. Vitest's previous wrapper patch only appended them after createRequire(config.root + "/package.json").resolve(pkg) succeeded, so absent packages were skipped; now the browser/server dependency optimizer can try to resolve names like @storybook/test from the project and fail in otherwise unrelated test configs. Please keep the old "only inline if installed" guard, or move this into a runtime config hook where the project root can be checked.
Useful? React with 👍 / 👎.


Summary
Deletes the bundled
@voidzero-dev/vite-plus-testwrapper and consumes upstreamvitest@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.vitestor@vitest/*separately; they come in transitively as direct deps ofvite-plus.vp migrateon an upstream-vitest project still forward-migratesvitest,vitest/*,@vitest/browser*, declare-module specifiers, and/// <reference types>directives to thevite-plus/test*surface (one-time transition).Notable changes:
packages/cli/build.ts:syncTestPackageExportsauto-generates./test/*shims from upstreamvitest'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-webdriverioas direct catalog deps pinned to4.1.5.crates/vite_global_cli/src/commands/version.rs: vitest ToolSpec points at thevitestpackage directly.packages/cli/src/resolve-test.ts: resolvesvitest/package.jsonand readsbin.vitestsovp testinvokes upstream vitest.packages/cli/src/utils/constants.ts: dropsvitestfromVITE_PLUS_OVERRIDE_PACKAGES; onlyviteremains a managed key.packages/cli/src/migration/migrator.ts:isVitestAdjacentflag that flipsneedVitePlus = truefor projects with packages likevitest-browser-svelteeven when there's no vite/oxlint/tsdown to migrate.pruneLegacyWrapperAliases/pruneYamlMapLegacyWrapperAliasessweeps that rewrite stalevitest: npm:@voidzero-dev/vite-plus-test@*aliases to^4.1.5(so existingcatalog:refs keep resolving) and drop other stale wrapper-targeted keys.packages/cli/src/migration/bin.ts: adds ahandleInstallResulthelper so failed reinstalls warn the user, append toreport.warnings, and flipprocess.exitCodeinstead of being silently reported as success.User-visible behavior changes
vp test -hand 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
cargo test -p vite_migration --lib: 167 tests passpnpm exec vitest run(packages/cli): 374 tests passpnpm bootstrap-clisucceedspnpm -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/webdriveriopreserved as peers, stalevite-plus-testcatalog aliases normalized to^4.1.5).vp teston a fixture usingimport { vi } from 'vite-plus/test';vi.mock(...). See "Follow-up" below.vp migrateon a fresh upstream-vitest project.pnpm installclean: zero@voidzero-dev/vite-plus-testreferences in the lockfile, browser-provider packages installed transitively viavite-plus.Follow-up
@vitest/mockerhoistsvi.mock(...)calls only when the import source is the literal string'vitest'(@vitest/mocker@4.1.5/dist/chunk-hoistMocks.jshardcodeshoistedModule = "vitest"). User code that importsvifrom'vite-plus/test'won't get its mocks hoisted, which silently breaks mocking. The plan is to contribute upstream ahoistedModule?: string | string[]option tohoistMocks()so vite-plus can pass['vitest', 'vite-plus/test']. Tracked as a separate effort — this PR ships the wrapper removal independently; the mocker fix can land later as a@vitest/mockerpoint release.🤖 Generated with Claude Code
Note
Medium Risk
Large packaging and migration surface (export shims, pnpm patches, import rewriter, CI overrides); wrong specifier mapping would break installs or
vp migrate, but scope is tooling not auth/data.Overview
This PR removes the published
@voidzero-dev/vite-plus-testwrapper and wires testing through upstreamvitestand@vitest/browser*while keepingvite-plus/test*as the stable public API (shims generated at CLI build time from vitest’s exports plus browser-provider projections).Packaging & build:
packages/clidrops the test workspace dependency, adds catalog-pinned vitest/browser packages, and expandssyncTestPackageExports(provider d.ts inlining,./test/browser/context, bare browser subpaths, plugin shims,@vitest/mockerpatch key renames). Release/publish workflows no longer version or ship the test package. Docs and READMEs now recommend only aviteoverride to core, not a separatevitestnpm alias.Migration (Rust):
import_rewritergrows substantially—require, dynamicimport, and re-exports; vitest/browser provider paths mapped to realvite-plusexport targets;declare module 'vitest*'left on upstream identities;vitest/package.jsonexcluded. File walking includes.cjs/.cts.vp versionreports vitest from the real package.CI & deps automation: E2E/
vp createtests stop packing the test tgz, pin core/cli to0.0.0, and userepack-vite-tgzso Bun can satisfy vitest’s vite peer.upgrade-deps.tsupdates catalog vitest,VITEST_VERSION, workflow pins, and the mocker patch instead ofpackages/test. Ecosystem-ci overrides use pinned vitest versions, not the wrapper tgz.User-visible note:
vp testshows vitest’s native branding;vi.mockhoisting fromvite-plus/testremains a known follow-up (mocker hardcodes'vitest').Reviewed by Cursor Bugbot for commit 80b0268. Bugbot is set up for automated code reviews on this repo. Configure here.