Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ jobs:
command: |
npx playwright install chromium
vp test
- name: vite-plus-vitest-type-aug
node-version: 24
command: |
vp check --fix
exclude:
# frm-stack uses Docker (testcontainers) which doesn't work the same way on Windows
- os: windows-latest
Expand Down
6 changes: 6 additions & 0 deletions ecosystem-ci/repo.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,11 @@
"repository": "https://github.com/why-reproductions-are-required/vitest-playwright-repro.git",
"branch": "main",
"hash": "f7252170025c01ec482fa9ad43e09b965f46928f"
},
"vite-plus-vitest-type-aug": {
"repository": "https://github.com/why-reproductions-are-required/vite-plus-vitest-type-aug.git",
"branch": "main",
"hash": "6192f60653c124ae068efaf5d7d0a4134c95edbd",
"forceFreshMigration": true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "migration-vitest-peer-dep",
"scripts": {
"dev": "vite",
"build": "vite build",
"test": "vitest"
},
"devDependencies": {
"vite": "^7.0.0",
"vitest-browser-svelte": "^2.1.0"
}
}
40 changes: 40 additions & 0 deletions packages/cli/snap-tests-global/migration-vitest-peer-dep/snap.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
> vp migrate --no-interactive # vitest should be added to devDeps when vitest-browser-svelte is present
VITE+ - The Unified Toolchain for the Web

◇ Migrated . to Vite+<repeat>
• Node <semver> pnpm <semver>
• 2 config updates applied

> cat package.json # vitest should be in devDependencies
{
"name": "migration-vitest-peer-dep",
"scripts": {
"dev": "vp dev",
"build": "vp build",
"test": "vp test",
"prepare": "vp config"
},
"devDependencies": {
"vite": "catalog:",
"vitest-browser-svelte": "^2.1.0",
"vite-plus": "catalog:",
"vitest": "catalog:"
},
"packageManager": "pnpm@<semver>"
}

> cat pnpm-workspace.yaml
catalog:
vite: npm:@voidzero-dev/vite-plus-core@latest
vitest: npm:@voidzero-dev/vite-plus-test@latest
vite-plus: latest
overrides:
vite: 'catalog:'
vitest: 'catalog:'
peerDependencyRules:
allowAny:
- vite
- vitest
allowedVersions:
vite: '*'
vitest: '*'
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"commands": [
"vp migrate --no-interactive # vitest should be added to devDeps when vitest-browser-svelte is present",
"cat package.json # vitest should be in devDependencies",
"cat pnpm-workspace.yaml"
]
}
9 changes: 9 additions & 0 deletions packages/cli/src/migration/migrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1399,6 +1399,15 @@ export function rewritePackageJson(
...pkg.devDependencies,
[VITE_PLUS_NAME]: version,
};
// Add vitest to devDependencies when a remaining dependency likely peer-depends
// on vitest (e.g., vitest-browser-svelte). Without this, pnpm resolves the real
// vitest for peer deps instead of @voidzero-dev/vite-plus-test, causing
// third-party type augmentations to target the wrong module.
const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };
if (!allDeps.vitest && Object.keys(allDeps).some((name) => name.includes('vitest'))) {
const ver = VITE_PLUS_OVERRIDE_PACKAGES.vitest;
pkg.devDependencies.vitest = supportCatalog && !ver.startsWith('file:') ? 'catalog:' : ver;
}
}
return extractedStagedConfig;
}
Expand Down
2 changes: 2 additions & 0 deletions packages/test/BUNDLING.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ When upgrading the vitest version:
- createNodeEntry() index-node.js with browser-provider
- copyBrowserClientFiles()
- createBrowserEntryFiles() browser/ entry files at package root
- patchModuleAugmentations() Rewrite @vitest/expect, @vitest/runner augmentations
- patchChaiTypeReference() Add @types/chai triple-slash reference
- createPluginExports() dist/plugins/* for pnpm overrides
- mergePackageJson()
- validateExternalDeps()
Expand Down
Loading