Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ Options:
--dir <path> Base directory to scan for the test files
--ui Enable UI
--open Open UI automatically (default: !process.env.CI)
--api [port] Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not be the actual port the server ends up listening on. If true will be set to 51204 or 63315 in browser mode. Use '--help --api' for more info.
--api [port] Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not be the actual port the server ends up listening on. If true will be set to 51204 or 23315 in browser mode. Use '--help --api' for more info.
--silent [value] Silent console output from tests. Use 'passed-only' to see logs from failing tests only.
--hideSkippedTests Hide logs for skipped tests
--reporter <name> Specify reporters (default, agent, minimal, blob, verbose, dot, json, tap, tap-flat, junit, tree, hanging-process, github-actions)
Expand All @@ -336,6 +336,8 @@ Options:
--dangerouslyIgnoreUnhandledErrors Ignore any unhandled errors that occur
--shard <shards> Test suite shard to execute in a format of <index>/<count>
--changed [since] Run tests that are affected by the changed files (default: false)
--since-last-run Run tests with dependencies modified since their last run, plus tests that failed (default: false)
--lastFailed Run only the tests that failed in the last run (default: false)
--sequence <options> Options for how tests should be sorted. Use '--help --sequence' for more info.
--inspect [[host:]port] Enable Node.js inspector (default: 127.0.0.1:9229)
--inspectBrk [[host:]port] Enable Node.js inspector and break before the test starts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Options:
--dir <path> Base directory to scan for the test files
--ui Enable UI
--open Open UI automatically (default: !process.env.CI)
--api [port] Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not be the actual port the server ends up listening on. If true will be set to 51204 or 63315 in browser mode. Use '--help --api' for more info.
--api [port] Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not be the actual port the server ends up listening on. If true will be set to 51204 or 23315 in browser mode. Use '--help --api' for more info.
--silent [value] Silent console output from tests. Use 'passed-only' to see logs from failing tests only.
--hideSkippedTests Hide logs for skipped tests
--reporter <name> Specify reporters (default, agent, minimal, blob, verbose, dot, json, tap, tap-flat, junit, tree, hanging-process, github-actions)
Expand All @@ -169,6 +169,8 @@ Options:
--dangerouslyIgnoreUnhandledErrors Ignore any unhandled errors that occur
--shard <shards> Test suite shard to execute in a format of <index>/<count>
--changed [since] Run tests that are affected by the changed files (default: false)
--since-last-run Run tests with dependencies modified since their last run, plus tests that failed (default: false)
--lastFailed Run only the tests that failed in the last run (default: false)
--sequence <options> Options for how tests should be sorted. Use '--help --sequence' for more info.
--inspect [[host:]port] Enable Node.js inspector (default: 127.0.0.1:9229)
--inspectBrk [[host:]port] Enable Node.js inspector and break before the test starts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Options:
--dir <path> Base directory to scan for the test files
--ui Enable UI
--open Open UI automatically (default: !process.env.CI)
--api [port] Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not be the actual port the server ends up listening on. If true will be set to 51204 or 63315 in browser mode. Use '--help --api' for more info.
--api [port] Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not be the actual port the server ends up listening on. If true will be set to 51204 or 23315 in browser mode. Use '--help --api' for more info.
--silent [value] Silent console output from tests. Use 'passed-only' to see logs from failing tests only.
--hideSkippedTests Hide logs for skipped tests
--reporter <name> Specify reporters (default, agent, minimal, blob, verbose, dot, json, tap, tap-flat, junit, tree, hanging-process, github-actions)
Expand All @@ -139,6 +139,8 @@ Options:
--dangerouslyIgnoreUnhandledErrors Ignore any unhandled errors that occur
--shard <shards> Test suite shard to execute in a format of <index>/<count>
--changed [since] Run tests that are affected by the changed files (default: false)
--since-last-run Run tests with dependencies modified since their last run, plus tests that failed (default: false)
--lastFailed Run only the tests that failed in the last run (default: false)
--sequence <options> Options for how tests should be sorted. Use '--help --sequence' for more info.
--inspect [[host:]port] Enable Node.js inspector (default: 127.0.0.1:9229)
--inspectBrk [[host:]port] Enable Node.js inspector and break before the test starts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { expect, test } from 'vite-plus/test';
import { createServer, isRunnableDevEnvironment } from 'vite-plus';

test('the bundled server shares the public Vite API', async () => {
const server = await createServer({ configFile: false, server: { middlewareMode: true } });
const server = await createServer({
configFile: false,
// This API identity check does not need a shared WebSocket listening port.
server: { middlewareMode: true, ws: false },
});
try {
expect(isRunnableDevEnvironment(server.environments.ssr)).toBe(true);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"packageManager": "pnpm@11.24.0",
"devDependencies": {
"vite-plus": "latest",
"@vitest/browser-playwright": "5.0.5",
"@vitest/browser-playwright": "5.1.0-beta.1",
"playwright": "1.57.0",
"typescript": "7.0.2"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "module",
"devDependencies": {
"vite-plus": "latest",
"@vitest/coverage-v8": "5.0.5",
"@vitest/coverage-istanbul": "5.0.5"
"@vitest/coverage-v8": "5.1.0-beta.1",
"@vitest/coverage-istanbul": "5.1.0-beta.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"name": "test-v5-install-managers",
"private": true,
"type": "module",
"devDependencies": { "vite-plus": "latest", "vitest": "5.0.5" }
"devDependencies": { "vite-plus": "latest", "vitest": "5.1.0-beta.1" }
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ steps = [
{ argv = ["vpt", "json-edit", "package.json", "packageManager", "npm@10.9.4"], snapshot = false },
# Match the bundled runner throughout npm's peer graph. Otherwise newer
# Vitest patches reached through optional peers can crash npm 10's resolver.
{ argv = ["vpt", "json-edit", "package.json", "overrides.vitest", "5.0.5"], snapshot = false },
{ argv = ["vpt", "json-edit", "package.json", "overrides.@vitest/browser", "5.0.5"], snapshot = false },
{ argv = ["vpt", "json-edit", "package.json", "overrides.vitest", "5.1.0-beta.1"], snapshot = false },
{ argv = ["vpt", "json-edit", "package.json", "overrides.@vitest/browser", "5.1.0-beta.1"], snapshot = false },
{ argv = ["vp", "install", "--ignore-scripts", "--", "--no-audit", "--no-fund"], snapshot = false, timeout = 180000 },
["vp", "test", "run"],
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
## `vpt json-edit package.json packageManager npm@10.9.4`


## `vpt json-edit package.json overrides.vitest 5.0.5`
## `vpt json-edit package.json overrides.vitest 5.1.0-beta.1`


## `vpt json-edit package.json overrides.@vitest/browser 5.0.5`
## `vpt json-edit package.json overrides.@vitest/browser 5.1.0-beta.1`


## `vp install --ignore-scripts -- --no-audit --no-fund`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "module",
"devDependencies": {
"vite-plus": "latest",
"@vitest/ui": "5.0.5",
"@vitest/ui": "5.1.0-beta.1",
"jsdom": "27.2.0",
"happy-dom": "20.0.10",
"temporal-polyfill": "1.0.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ steps = [{ argv = ["node", "verify.mjs"], timeout = 120000 }]
name = "upstream_real_timers"
vp = "local"
env = { PLAYWRIGHT_BROWSERS_PATH = "0" }
comment = "Known upstream regression introduced in Vitest 4.1.1 and still present in 5.0.1, not a new v5 release blocker: Preview locator clicks advance fake timers while using real timers. Require success when upstream fixes it."
comment = "Known upstream regression introduced in Vitest 4.1.1 and still present in 5.1.0-beta.1, not a new v5 release blocker: Preview locator clicks advance fake timers while using real timers. Require success when upstream fixes it."
steps = [{ argv = ["node", "verify.mjs", "--real-timers"], timeout = 120000 }]

[[case]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# upstream_real_timers

Known upstream regression introduced in Vitest 4.1.1 and still present in 5.0.1, not a new v5 release blocker: Preview locator clicks advance fake timers while using real timers. Require success when upstream fixes it.
Known upstream regression introduced in Vitest 4.1.1 and still present in 5.1.0-beta.1, not a new v5 release blocker: Preview locator clicks advance fake timers while using real timers. Require success when upstream fixes it.

## `node verify.mjs --real-timers`

```
Browser runner started at http://localhost:<port>/__vitest_test__/?sessionId=<uuid>

Known upstream regression since Vitest 4.1.1: Preview locator clicks fail with real timers in 5.0.5
Known upstream regression since Vitest 4.1.1: Preview locator clicks fail with real timers in 5.1.0-beta.1
```
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# The community provider accepts newer @vitest/browser patches. Keep this
# fixture on the bundled runner's version when testing the packed package.
# Keep the community provider's @vitest/browser aligned with the bundled
# runner when testing the packed package, including prereleases.
overrides:
'@vitest/browser': 5.0.5
vitest: 5.0.5
'@vitest/browser': 5.1.0-beta.1
vitest: 5.1.0-beta.1
2 changes: 1 addition & 1 deletion docs/guide/migrate.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ View and copy this prompt into your coding agent to upgrade an existing Vite+ 0.

### Vitest

Vitest is automatically migrated through `vp migrate`. `vite-plus` re-exports upstream `vitest@5.0.5` under `vite-plus/test*`, so for node-mode tests a single `vite-plus` install is enough — you no longer need to install `vitest` directly.
Vitest is automatically migrated through `vp migrate`. `vite-plus` re-exports upstream `vitest@5.1.0-beta.1` under `vite-plus/test*`, so for node-mode tests a single `vite-plus` install is enough — you no longer need to install `vitest` directly.

For browser mode, you can use the base browser runtime (`@vitest/browser`) and Preview provider (`@vitest/browser-preview`) included in `vite-plus`. To use Playwright or WebDriverIO, you also need the opt-in provider (`@vitest/browser-playwright` or `@vitest/browser-webdriverio`) and its framework peer (`playwright` or `webdriverio`).

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

`vp test` runs tests with [Vitest](https://vitest.dev).

Vite+ depends on Vitest `5.0.5`, which requires Node `^22.18.0 || ^24.11.0 || >=26.0.0`. For existing projects, follow [Upgrade to Vitest 5](./vitest-v5.md) before updating dependencies.
Vite+ depends on Vitest `5.1.0-beta.1`, which requires Node `^22.18.0 || ^24.11.0 || >=26.0.0`. For existing projects, follow [Upgrade to Vitest 5](./vitest-v5.md) before updating dependencies.

`vp test` resolves Vitest from `vite-plus`'s dependencies first, then from your project.

Expand Down
4 changes: 2 additions & 2 deletions docs/guide/vitest-v5.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Upgrade to Vitest 5

Vite+ bundles Vitest `5.0.5`. Use Node `^22.18.0 || ^24.11.0 || >=26.0.0` for the CLI and tests.
Vite+ bundles Vitest `5.1.0-beta.1`. Use Node `^22.18.0 || ^24.11.0 || >=26.0.0` for the CLI and tests.

## Before you migrate

Expand Down Expand Up @@ -126,7 +126,7 @@ Review calls with benchmark options, imported or reassigned callbacks, callback

## Entry points and packages

Use `vite-plus/test` for assertions and supported runner APIs. Keep coverage providers and `@vitest/ui` at the bundled runner's exact version, `5.0.5`. Keep `@vitest/web-worker` aligned when your project uses it.
Use `vite-plus/test` for assertions and supported runner APIs. Keep coverage providers and `@vitest/ui` at the bundled runner's exact version, `5.1.0-beta.1`. Keep `@vitest/web-worker` aligned when your project uses it.

| v4 import | v5 import or action |
| ---------------------------------------- | --------------------------------------------------------------------------- |
Expand Down
26 changes: 9 additions & 17 deletions ecosystem-ci/npmx.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
export function patchNpmxVitestConfig(config: string): string {
// The pinned Nuxt project uses liveDollarFetch to avoid capturing a stale
// $fetch during browser tests. Keep it when adding our optimizer workaround.
const nuxtProject =
/defineVitestProject\(\{\s*plugins:\s*\[\s*liveDollarFetch\(\)\s*,?\s*\],\s*test:\s*\{/g;
// $fetch during browser tests. Keep it and the upstream Vue compiler alias.
const nuxtProject = /defineVitestProject\(\{\s*plugins:\s*\[\s*liveDollarFetch\(\)\s*,?\s*\]/g;
if ([...config.matchAll(nuxtProject)].length !== 1) {
throw new Error('npmx.dev patch: expected the pinned Nuxt test project configuration');
}
return config.replace(
nuxtProject,
`defineVitestProject({
plugins: [liveDollarFetch(), {
// Temporary Vitest 5 workaround: preserve Nuxt's optimizer exclusions.
// Remove when upstream preserves these exclusions after the merge.
// https://github.com/why-reproductions-are-required/vitest-browser-optimizer-config-order
name: 'npmx:test:preserve-optimizer-exclusions',
configureServer(server) {
for (const options of [
server.config.optimizeDeps,
server.environments.client.config.optimizeDeps,
]) {
const excluded = new Set(options.exclude ?? [])
options.include = options.include?.filter(dep => !excluded.has(dep))
}
name: 'npmx:test:vitest-compat',
config() {
// Nuxt imports app modules before per-file vi.mock calls run.
// Use request interception so those modules can still be mocked.
// https://vitest.dev/config/browser/importmapmocks
return { test: { browser: { importMapMocks: false } } }
},
}],
test: {`,
}]`,
);
}
15 changes: 11 additions & 4 deletions ecosystem-ci/patch-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ if (process.env.GITHUB_ENV) {

await prepareWebdriverioProject(project, repoRoot, cli);

if (project === 'npmx.dev') {
// The pinned workspace enables strict peer checks. Supply devframe's optional
// cac peer explicitly so migration satisfies its ^7.0.0 requirement.
const packagePath = join(repoRoot, 'package.json');
const pkg = JSON.parse(await readFile(packagePath, 'utf-8'));
pkg.devDependencies.cac = '7.0.0';
await writeFile(packagePath, `${JSON.stringify(pkg, null, 2)}\n`, 'utf-8');
}

if (project === 'rollipop') {
const oxfmtrc = await readFile(join(repoRoot, '.oxfmtrc.json'), 'utf-8');
await writeFile(
Expand Down Expand Up @@ -361,10 +370,8 @@ ${registration}`,
}

if (project === 'npmx.dev') {
// Vitest 5 adds browser optimizer dependencies after Nuxt's config hook has
// filtered its exclusions. Reapply that filter only in the Nuxt test project.
// Remove when an upstream fix preserves those exclusions after the merge.
// https://github.com/why-reproductions-are-required/vitest-browser-optimizer-config-order
// Nuxt loads app modules before per-file mocks; use request interception.
// https://vitest.dev/config/browser/importmapmocks
const viteConfigPath = join(repoRoot, 'vite.config.ts');
const viteConfig = await readFile(viteConfigPath, 'utf-8');
await writeFile(viteConfigPath, patchNpmxVitestConfig(viteConfig), 'utf-8');
Expand Down
4 changes: 2 additions & 2 deletions ecosystem-ci/repo.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"npmx.dev": {
"repository": "https://github.com/npmx-dev/npmx.dev.git",
"branch": "main",
"hash": "0e44738831077879c7ab00469fc50f5dbcf18650",
"hash": "3472596fa5e63dea39bd6c5f3fb561371d2f6034",
"forceFreshMigration": true,
"playwright": true
},
Expand All @@ -117,7 +117,7 @@
"vite-plus-jest-dom-repro": {
"repository": "https://github.com/why-reproductions-are-required/vite-plus-jest-dom-repro.git",
"branch": "master",
"hash": "01bd9ce1ac66ee3c21ed8a7f14311317d87fb999",
"hash": "7b37379a257da03fc06658863ed3b61685ba63c7",
"forceFreshMigration": true
},
"bun-vite-template": {
Expand Down
11 changes: 10 additions & 1 deletion packages/cli/src/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ const commandHelpDocs = {
{
label: '--api [port]',
description:
"Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not be the actual port the server ends up listening on. If true will be set to 51204 or 63315 in browser mode. Use '--help --api' for more info.",
"Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not be the actual port the server ends up listening on. If true will be set to 51204 or 23315 in browser mode. Use '--help --api' for more info.",
},
{
label: '--silent [value]',
Expand Down Expand Up @@ -311,6 +311,15 @@ const commandHelpDocs = {
label: '--changed [since]',
description: 'Run tests that are affected by the changed files (default: false)',
},
{
label: '--since-last-run',
description:
'Run tests with dependencies modified since their last run, plus tests that failed (default: false)',
},
{
label: '--lastFailed',
description: 'Run only the tests that failed in the last run (default: false)',
},
{
label: '--sequence <options>',
description:
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const VITE_CONFIG_FILES = [
'vite.config.cts',
] as const;

export const VITEST_VERSION = '5.0.5';
export const VITEST_VERSION = '5.1.0-beta.1';

// Exact action release used by generated workflows and the @v1 migration.
// The Renovate custom manager keeps this value current.
Expand Down
Loading
Loading