refactor: replace @voidzero-dev/vite-plus-test with upstream vitest#1588
refactor: replace @voidzero-dev/vite-plus-test with upstream vitest#1588Brooooooklyn wants to merge 110 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".
…installs @vitest/browser-webdriverio@4.1.7 declares `webdriverio` as a non-optional peer dep. pnpm v10's autoInstallPeers (default true) then installs webdriverio → edgedriver/geckodriver, which have postinstall scripts pnpm v10 refuses to run without explicit allowBuilds entries. Every vite-plus user on pnpm v10 hit the warning at install time, even if they don't use vitest browser mode. vp migrate now writes the allow/deny decision up front so users don't have to manage it themselves: - pnpm v10+ workspace YAML or `pnpm.allowBuilds` in package.json: writes edgedriver/geckodriver entries (true when webdriverio is a real dep, false otherwise) - pnpm v9 onlyBuiltDependencies: appends only when webdriverio is used (v9 omission already denies, so no-op otherwise) - Pre-existing user entries are respected — re-runs are idempotent - Monorepo detection scans root + all sub-packages Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…tries vp migrate now writes default edgedriver/geckodriver allowBuilds entries to pnpm-workspace.yaml on every pnpm v10+ project, so all pnpm migration snaps gain a 3-line allowBuilds block. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…lowBuilds vp create on a pnpm v10+ workspace now emits default edgedriver/geckodriver allowBuilds entries. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…eration When regenerating pnpm migration snaps for the allowBuilds change, the local run captured two environment-specific outputs that differ from CI: - command-list-yarn1: local yarn1 emitted a "react-compiler-runtime" link-missing warning that CI's yarn1 doesn't - create-next-command-monorepo-library: vp create exited 1 locally instead of scaffolding successfully (likely an environmental side-effect of the preceding regen passes) Both snaps are restored to their pre-regen content. The allowBuilds-driven 3-line additions only apply to pnpm migration paths; neither of these tests touches the allowBuilds code. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
CI's `vp check` flagged formatting in the new allowBuilds helpers. Running oxfmt locally aligns the indentation/wrapping with the rest of the file. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…uccess Reviewer cursor[bot] (PR #1588): when a pre-migration install succeeds but the post-migration reinstall fails, `installDurationMs` is the sum of both and is still > 0, so showMigrationSummary printed a green ✔ "Dependencies installed" line alongside the warning — misleading because node_modules is desynced. executeMigrationPlan now returns finalInstallOk (= finalInstallSummary .status === 'installed'); main does the same for the early-return hasVitePlusDependency branch. showMigrationSummary gates the green line on `finalInstallOk && installDurationMs > 0`. Also: .github/scripts/upgrade-deps.ts — updateTestVpCreateWorkflow now calls recordChange so vitest bumps to the workflow are tracked in the generated PR metadata, matching every other update function in the file. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…w signal Reviewer chatgpt-codex-connector[bot] (PR #1588): when a user has `@vitest/browser-webdriverio` in deps but no direct `webdriverio`, hasOwnWebdriverioDependency returned false → allowBuilds wrote edgedriver/geckodriver as `false`. But then rewritePackageJson removes @vitest/browser-webdriverio and injects `webdriverio: '*'` as its peer (via REMOVE_PACKAGES + BROWSER_PROVIDER_PEER_DEPS), so the migrated project ends up needing the drivers — and the allowBuilds decision already denied them. Now hasOwnWebdriverioDependency treats either `webdriverio` or `@vitest/browser-webdriverio` as the signal. workspaceUsesWebdriverio inherits the change transitively (delegates to the same helper). Added unit test covering the @vitest/browser-webdriverio-only fixture. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Reviewer chatgpt-codex-connector[bot] (PR #1588): hasOwnWebdriverioDependency only checked dependencies/devDependencies/optionalDependencies, but rewritePackageJson's REMOVE_PACKAGES loop also iterates peerDependencies — so `@vitest/browser-webdriverio` declared as a peer was removed and replaced with `webdriverio: '*'` while the allowBuilds decision had already denied the driver postinstalls. Extend the helper (and DependencyBag) to scan peerDependencies. Added a unit test covering the peer-only fixture. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…YAML Reviewer chatgpt-codex-connector[bot] (PR #1588): cleanupPnpmOverridesFor- WorkspaceYaml already deletes REMOVE_PACKAGES entries from `pkg.pnpm .overrides`, but the YAML-side rewritePnpmWorkspaceYaml never did the same sweep on `pnpm-workspace.yaml`'s `overrides:` block. A workspace that had pinned e.g. `@vitest/browser-playwright: 4.0.0` would keep that override after migration — and since vite-plus now direct-deps the provider at VITEST_VERSION, the stale override forced a version mismatch with the bundled vitest. rewritePnpmWorkspaceYaml now drops every REMOVE_PACKAGES key from the YAML overrides map after the legacy-wrapper-alias prune. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Reviewer chatgpt-codex-connector[bot] (PR #1588): the previous override cleanup only matched exact REMOVE_PACKAGES keys, so pnpm override selectors like `@vitest/browser-playwright@4: 4.0.0` or `vite-plus>@vitest/browser-playwright: 4.0.0` survived the migration. Those selectors then applied against vite-plus's own direct provider dependency, re-creating the version-skew bug the bare-key cleanup was meant to prevent. Added a small helper `extractOverrideTargetName` that strips both the parent-selector prefix (`parent>`) and the trailing version (`@1`) while preserving scoped names (`@scope/pkg`). The rewritePnpmWorkspaceYaml sweep now iterates the YAML overrides snapshot, parses each key through the helper, and deletes any whose target package is in REMOVE_PACKAGES. Extended the existing test fixture to also include `@vitest/browser- playwright@4`, `vite-plus>@vitest/browser-playwright`, and an unrelated `unrelated>some-other-pkg` selector — asserts the browser selectors are dropped while unrelated selectors survive. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
CI's oxlint flagged the single-statement `if (!trimmed) return trimmed;` introduced in the last commit. Wrapping it in braces aligns with the project's curly rule. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
… pkg.json overrides Two open review issues on the pnpm v10 migration path: * `allowBuilds.<driver> = false` was unconditionally written for `edgedriver` and `geckodriver` whenever the webdriverio signal forced the migration to manage them. If a project already depended on either driver directly (e.g. a non-webdriverio Selenium setup), the migration silently blocked their own postinstall. Collect `directDriverDeps` from the user's package.json and skip those keys in both the `pnpm-workspace.yaml` and `package.json` allowBuilds writers — pnpm prompts on first install as usual. * The selector-aware override cleanup added for `pnpm-workspace.yaml` in 695dcf5 did not apply to the `package.json` `pnpm.overrides` sink, so selector-shaped keys like `vite-plus>@vitest/browser-playwright` survived migration and could re-pin vite-plus's own provider dep to an incompatible version. Extract the deletion as `dropRemovePackageOverrideKeys` and invoke it from the standalone package.json path, `cleanupPnpmOverridesForWorkspaceYaml`, and the force-override root-workspace path. Reuse the shared helper inside `rewritePnpmWorkspaceYaml` so all sinks go through the same matcher. Adds five regression tests covering both fixes. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The prefer-vite-plus-imports oxlint rule rewrote any `vitest/<sub>` to `vite-plus/test/<sub>`, including `vitest/package.json`. But upstream vitest exposes `./package.json` (resolvable today) while the generated `vite-plus` exports map deliberately omits `./test/package.json` (syncTestPackageExports skips upstream's `./package.json`). So under `vp lint --fix` the autofix turned a working metadata import into one that fails with ERR_PACKAGE_PATH_NOT_EXPORTED. Skip `vitest/package.json` in rewriteVitePlusImportSpecifier, mirroring the migrate rewriter's existing exclusion in import_rewriter.rs (`^['"]vitest/(package\.json|config)['"]$`). Other `vitest/<sub>` specifiers still rewrite normally. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…orts
Migration rewrites the `vitest/config` specifier to bare `vite-plus`
(Rust import_rewriter + the prefer-vite-plus-imports oxlint rule), so
the `vite-plus` root must re-export every runtime `vitest/config` symbol
or migrated `import { x } from 'vitest/config'` (and the require form)
resolves to undefined. index.ts (ESM) and index.cts (CJS) are separate
manual lists, so add superset guards on BOTH module systems — a future
vitest bump that adds a config export can't be fixed in one entry while
the other silently regresses. Each guard includes a non-empty sanity
assertion so it can't false-pass if enumeration breaks.
Type-only exports are out of scope here: removal-drift in index.ts's
`export type` list is already caught by the repo typecheck.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
vp migrate of a pnpm v10 monorepo wrote `allowBuilds.<driver> = false` for edgedriver/geckodriver even when the root or a workspace package already directly depended on that driver, as long as no package used webdriverio — denying a postinstall the user already relied on. The standalone path collects `directDriverDeps` (via collectDirectDriverDeps) and threads it into the allowBuilds writers, which skip user-owned drivers. The monorepo path never collected them, so both pnpm v10 sinks (pnpm-workspace.yaml and the root package.json `pnpm.allowBuilds`) got an empty set. Add `collectWorkspaceDirectDriverDeps`, mirroring workspaceUsesWebdriverio's root+sub-package traversal, and thread it through rewriteMonorepo -> rewritePnpmWorkspaceYaml / rewriteRootWorkspacePackageJson -> applyBuildAllowanceToPackageJsonPnpm. The v9 onlyBuiltDependencies path (omission == denial) is unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…is present The direct-driver skip in the pnpm v10 allowBuilds writers suppressed the write unconditionally, so in a mixed setup — a package depends on edgedriver/geckodriver directly AND webdriverio is also present — the driver key was left absent instead of `true`. Because the allowBuilds sink is workspace-global, that absent key forces a pnpm prompt for a build webdriverio actually needs. Gate the skip on `!shouldAllow`: only suppress the `false` deny path (no webdriverio, so don't override a user-managed driver). When webdriverio makes builds allowed, write `true` even for a user-owned driver. Updates the standalone webdriverio+direct-driver test to the new expectation and adds a mixed-workspace monorepo regression (package A edgedriver, package B webdriverio -> both drivers allowed). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Per review feedback ("avoid defaulting to depend on @vitest/browser-webdriverio,
its usage is low"), webdriverio is no longer a bundled runtime dependency of
vite-plus. It moves to a devDependency + optional peerDependency (catalog:), and
`vp migrate` now KEEPS the provider in the user's own deps (pinned to the bundled
VITEST_VERSION) instead of stripping it, so the rewritten
`vite-plus/test/browser-webdriverio` import still resolves under pnpm strict /
Yarn PnP. playwright/preview stay bundled and stripped as before.
Migration details:
- Drop only stale FLAT override/resolution pins that TARGET the provider, so a
leftover pin can't force the provider off the migrated 4.1.7 dep (npm EOVERRIDE
/ yarn-bun version skew). Catalog entries are preserved to avoid dangling
`catalog:` references.
- extractOverrideTargetName parses pnpm `>` parent selectors via pnpm's own
delimiter rule (/[^ |@]>/) so semver comparator ranges (`@>=4`, `@>4`, `@<5`)
aren't mis-split, and takes the trailing descriptor of a yarn from/target
selector (matching @yarnpkg/parsers).
- Detect webdriverio usage from source for pre-migration
`@vitest/browser-webdriverio*`, and the migrated
`vite-plus/test/browser-webdriverio*`,
`vite-plus/test/browser/providers/webdriverio*`, and
`vite-plus/test/plugins/browser-webdriverio` (shim) specifiers, so re-runs and
source-only projects still get the provider + `webdriverio` peer injected and
the edgedriver/geckodriver builds allowed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The comparator-range test comment used "mis-parses"; crate-ci/typos tokenizes the hyphenated word and flags the standalone `mis` token, failing the CI Lint job before oxlint even runs. Reword to "is parsed incorrectly" — no behavior change, comment only. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`usesVitestBrowserMode` only matched `@vitest/browser` and
`vite-plus/test/browser`, so a package importing the published browser
shims that carry no `browser` substring went undetected: the import
rewriter flattens `@vitest/browser/{client,locators,matchers,utils}` to
`vite-plus/test/{…}`, and `build.ts` also publishes the bare
`vite-plus/test/context`, the `vite-plus/test/plugins/browser*` family,
and `vite-plus/test/internal/browser`. With no `@vitest/browser*` dep
for the dep-based signal, `effectiveBrowserMode` stayed false and the
direct `vitest` pin (which the browser optimizer needs resolvable from
the package root under pnpm strict / Yarn PnP) was skipped.
Add hints covering the full published browser surface — verified
complete against every browser-surface `./test/*` export — and a
parametrized regression asserting `vitest` is pinned without injecting
`@vitest/browser`. A single `vite-plus/test/plugins/browser` prefix
covers the whole plugin family; all added subpaths are browser-only
re-exports, so they never collide with a non-browser vitest export.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Reconciles the branch's dependency changes (es-module-lexer, oxc-parser, opt-in @vitest/browser-webdriverio, removal of @voidzero-dev/vite-plus-test) with main's upstream dependency upgrades (#1713). Verified: frozen-lockfile install passes, @vitest/mocker resolves at the patched 4.1.7, and there are no stale @voidzero-dev/vite-plus-test references. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
62a30a2 to
d646df0
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d646df0712
ℹ️ 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".
…d Vitest
`vp test` resolved the runner binary CWD-first, so a project that keeps its
own `vitest` dependency would spawn the project's Vitest while the
`vite-plus/test*` shims (`export * from 'vitest'`) resolved to vite-plus's
bundled copy — two physical Vitest instances in one run, a classic source of
internal-state and mock-hoisting mismatches.
- constants.ts: add `resolveBundled()` (CLI-dir-first, project-cwd fallback)
alongside `resolve()` (cwd-first).
- resolve-test.ts: resolve the runner binary via `resolveBundled('vitest/package.json')`
so `vp test` always runs the bundled (pinned) Vitest.
- define-config.ts: flip `vite-plus:vitest-resolver` to bundle-first. It now
re-resolves the `vitest` / `@vitest/*` family through Vite's OWN resolver
rooted at vite-plus's location and then the bundled vitest's location, before
the project. Routing through `this.resolve` (not raw `require.resolve`) honours
ESM export conditions — `require.resolve('vitest')` would pick Vitest's
`require`-condition CJS throw-stub (`index.cjs` / `config.cjs`). Two bundled
anchors are needed: `@vitest/browser*` are direct deps of vite-plus while the
nested `@vitest/*` family are deps of vitest (pnpm isolated layout). The
project root stays as the last resort.
For the common migrated layout (project depends only on vite-plus) nothing in
the family resolves from the project root anyway, so this is identical there;
it only changes the project-keeps-its-own-vitest case, which is exactly the case
to pin. Explicit project `resolve.alias`/`resolve.dedupe` on the family (not a
Vitest 4.x default) is respected as an opt-out; coverage providers, not shipped
with vite-plus, follow project resolution (Vitest version-checks them).
Adds resolve-test.spec.ts (runner is bundled, never the project copy) and
bundle-first/CJS-stub regression coverage in define-config-vitest-resolver.spec.ts.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rovider pins
`dropRemovePackageOverrideKeys` only inspected TOP-LEVEL override keys, so an
npm/bun nested override like `{ "vite-plus": { "@vitest/browser-playwright":
"4.0.0" } }` left the nested provider pin in place. After migration strips the
provider packages from the user manifest, vite-plus owns them as direct deps, so
the surviving nested pin forces vite-plus's provider to an incompatible version.
Make the drop parent-aware. npm/bun nested overrides are SCOPED, so a provider
pin is dropped only where it affects vite-plus's provider ownership — at the top
level (a global pin reaches vite-plus's bundled copy) and inside a `vite-plus`
subtree. Under any other parent the pin targets that parent's own dependency
graph and is the user's to keep; we descend there only to reach a nested
`vite-plus`. A long-form provider override drops its own version pin (`.`) while
keeping unrelated children, and a parent we empty is pruned.
Two object-safety fixes on the same nested-override path:
- `isLegacyWrapperSpec` accepted `string | undefined` and called `.startsWith`;
`pruneLegacyWrapperAliases(pkg.overrides)` runs before the drop, so a nested
object value crashed. Broaden to `unknown` and return false for non-strings
(identical behavior for strings/undefined).
- The bun catalog rewrite passed each managed override value into
`getCatalogDependencySpec` (which calls `.startsWith`); a nested object under a
managed key (e.g. `{ "vitest": { "@vitest/runner": "4.0.0" } }`) crashed and
would clobber the user's nested override. Skip non-string values.
Adds 10 tests: vite-plus-scoped drop + prune; unrelated-parent preservation;
non-provider sibling/child preservation; top-level global + long-form `.` drop;
deep vite-plus-scoped drop; deep unrelated preservation; pre-existing empty `{}`
untouched; and a bun monorepo nested-managed-override no-crash regression.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c584b7240a
ℹ️ 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".
`vp check` (oxfmt) flagged formatting in the two new spec files added by the
prior two commits; apply the formatter (line-wrapping only, no behavior change).
Also correct an imprecise comment in define-config.ts: only the bare `vitest`
root's `require`-condition entry (`index.cjs`) is a throw-stub. `vitest/config`'s
`require` target (`config.cjs`) is a real CJS build — `require('vitest/config')`
does NOT throw, so the CJS `vite-plus` entry (`index.cts`) and migrated
`require('vite-plus')` configs work. The resolver still prefers the ESM entry for
the test server's module graph; the rationale is ESM-vs-CJS, not a throw-stub,
for subpaths like `vitest/config`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c136966811
ℹ️ 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".
unicorn(consistent-function-scoping): the helper captures nothing from its parent scope, so the nested declaration recreated it on every call and failed `vp check` in the CLI E2E job on all platforms. Move it beside the other module-scope helpers; behavior is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…'s own dep
The override cleanup peeled selector keys to their target package, so a
provider pin scoped under an unrelated parent (`some-app>@vitest/browser-*`
in pnpm, `some-parent/@vitest/browser-*` in yarn, or the npm/bun nested
`{ some-pkg: { @vitest/...: x } }`) was deleted even though it never
touches vite-plus's own (now direct-dep) provider — silently changing that
parent's transitive resolution.
Decide reachability by matching the full parent chain against the protected
edge `<root> -> vite-plus -> @vitest/provider` (a single `vite-plus`
ancestor): `extractOverrideParentSegments` returns the ordered chain and
`parentChainReachesVitePlus` drops `**` wildcards then requires at most one
concrete ancestor that glob-matches `vite-plus`. Version/range wildcards
(`parent@*`) are stripped before glob classification, and the nested
npm/bun traversal threads the accumulated ancestor chain so it matches the
flat-selector semantics. Global pins, `vite-plus`-parent selectors, and
globs that match `vite-plus` (`**`, `vite-*`) are still dropped.
A selector whose parent is the project's own package name is preserved as a
documented, accepted edge (see comment) per the posted PR review.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cbc007fb90
ℹ️ 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".
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
Changes affect daily dep upgrades, release/preview publish lists, and e2e/create smoke installs where Vitest peer resolution (especially Bun) must stay correct.
Overview
This diff wires upstream Vitest into release automation and CI after dropping
@voidzero-dev/vite-plus-test, and updates user-facing docs to only overridevite(notvitest).Dependency bumps (
upgrade-deps.ts) now keepvitest, all pinned@vitest/*catalog entries,VITEST_VERSION,test-vp-createoverride pins, and the@vitest/mockerpnpm patch key/file in sync on daily upgrades—replacing the oldpackages/testbump path.CI packaging stops packing/publishing the test wrapper:
e2e-test,test-vp-create,release,prepare_release, andpkg.pr.newonly handle core + cli. Pack jobs pin0.0.0tgz names and addrepack-vite-tgzso Bun can satisfy Vitest’speer vitevia a masqueradedvite-7.99.0.tgz;test-vp-createpins Vitest packages by semver instead of a test-wrapper tgz.vp --versionreports Vitest from the realvitestpackage. Migration walks.cjs/.ctsfor legacyrequire('vite-plus/test/...')rewrites. README manual migration dropsvitestoverride examples.Reviewed by Cursor Bugbot for commit cbc007f. Bugbot is set up for automated code reviews on this repo. Configure here.