diff --git a/packages/plugin-rsc/e2e/fixture.ts b/packages/plugin-rsc/e2e/fixture.ts index 25ee2a5e..6faff1b0 100644 --- a/packages/plugin-rsc/e2e/fixture.ts +++ b/packages/plugin-rsc/e2e/fixture.ts @@ -166,6 +166,7 @@ export function useFixture(options: { export async function setupIsolatedFixture(options: { src: string dest: string + overrides?: Record }) { // copy fixture fs.rmSync(options.dest, { recursive: true, force: true }) @@ -184,10 +185,16 @@ export async function setupIsolatedFixture(options: { /overrides:\s*([\s\S]*?)(?=\n\w|\n*$)/, ) const overridesSection = overridesMatch ? overridesMatch[0] : 'overrides:' + const overrides = { + '@vitejs/plugin-rsc': `file:${path.join(rootDir, 'packages/plugin-rsc')}`, + '@vitejs/plugin-react': `file:${path.join(rootDir, 'packages/plugin-react')}`, + ...options.overrides, + } const tempWorkspaceYaml = `\ ${overridesSection} - '@vitejs/plugin-rsc': ${JSON.stringify('file:' + path.join(rootDir, 'packages/plugin-rsc'))} - '@vitejs/plugin-react': ${JSON.stringify('file:' + path.join(rootDir, 'packages/plugin-react'))} +${Object.entries(overrides) + .map(([k, v]) => ` ${JSON.stringify(k)}: ${JSON.stringify(v)}`) + .join('\n')} ` fs.writeFileSync( path.join(options.dest, 'pnpm-workspace.yaml'), diff --git a/packages/plugin-rsc/e2e/isolated.test.ts b/packages/plugin-rsc/e2e/isolated.test.ts index a457daf5..85e4d4fa 100644 --- a/packages/plugin-rsc/e2e/isolated.test.ts +++ b/packages/plugin-rsc/e2e/isolated.test.ts @@ -3,6 +3,7 @@ import { setupIsolatedFixture, useFixture } from './fixture' import { defineStarterTest } from './starter' import path from 'node:path' import os from 'node:os' +import * as vite from 'vite' test.describe(() => { // use RUNNER_TEMP on Github Actions @@ -25,3 +26,31 @@ test.describe(() => { defineStarterTest(f) }) }) + +test.describe('vite 6', () => { + test.skip(!!process.env.ECOSYSTEM_CI || 'rolldownVersion' in vite) + + const tmpRoot = path.join( + process.env['RUNNER_TEMP'] || os.tmpdir(), + 'test-vite-rsc-vite-6', + ) + test.beforeAll(async () => { + await setupIsolatedFixture({ + src: 'examples/starter', + dest: tmpRoot, + overrides: { + vite: '^6', + }, + }) + }) + + test.describe('dev', () => { + const f = useFixture({ root: tmpRoot, mode: 'dev' }) + defineStarterTest(f) + }) + + test.describe('build', () => { + const f = useFixture({ root: tmpRoot, mode: 'build' }) + defineStarterTest(f) + }) +})