Skip to content

test(e2e-rsc): migrate to playwrightModes and dynamic inferred dist#7222

Merged
beaussan merged 1 commit intoTanStack:mainfrom
beaussan:move-rsc-to-dynamic-playwright
Apr 18, 2026
Merged

test(e2e-rsc): migrate to playwrightModes and dynamic inferred dist#7222
beaussan merged 1 commit intoTanStack:mainfrom
beaussan:move-rsc-to-dynamic-playwright

Conversation

@beaussan
Copy link
Copy Markdown
Contributor

@beaussan beaussan commented Apr 18, 2026

Summary

  • migrate e2e/react-start/rsc from legacy nx.metadata.playwrightShards to nx.metadata.playwrightModes using { toolchain: \"vite\", mode: \"ssr\", shards: 6 }
  • make the RSC e2e build output dynamic via E2E_DIST_DIR in Vite config so inferred mode/toolchain targets build into mode-specific folders (for example dist-vite-ssr)
  • make the RSC start command read server output from ${E2E_DIST_DIR:-dist} and ignore inferred dist folders in .gitignore

Verification

  • ran CI=1 NX_DAEMON=false pnpm nx run tanstack-react-start-e2e-rsc:test:e2e--vite-ssr--shard-1-of-6 --outputStyle=stream --skipRemoteCache
  • confirmed build artifacts are produced under dist-vite-ssr/... and the shard target completes successfully

Summary by CodeRabbit

  • Chores
    • Updated build configuration to support environment-based output directory settings
    • Enhanced test infrastructure with improved Playwright testing configuration
    • Refined build artifact exclusion patterns for cleaner build environments

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 18, 2026

📝 Walkthrough

Walkthrough

The changes enable configurable build output directories for an e2e React/RSC test suite by introducing environment variable support in Vite configuration, updating scripts to use dynamic paths, adjusting Nx test metadata, and expanding .gitignore to exclude build artifacts from multiple build tools.

Changes

Cohort / File(s) Summary
Build Configuration & Output
e2e/react-start/rsc/vite.config.ts, e2e/react-start/rsc/package.json, e2e/react-start/rsc/.gitignore
Added environment-variable support for configurable build output directory via E2E_DIST_DIR in Vite config and start script; updated Nx metadata from playwrightShards to playwrightModes array with toolchain specification; expanded .gitignore to exclude Vite and Rsbuild-specific build artifacts.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 Paths now dance with variables true,
Build outputs configured anew,
Vite and Rsbuild find their place,
In gitignore's expanding space,
Flexibility hopping along the way! 🌱

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: migrating to playwrightModes and implementing dynamic dist directory inference via environment variable.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Apr 18, 2026

View your CI Pipeline Execution ↗ for commit 1773b3c

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 4m 4s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 5s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-18 21:17:03 UTC

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 18, 2026

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@7222

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@7222

@tanstack/eslint-plugin-start

npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@7222

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@7222

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/@tanstack/nitro-v2-vite-plugin@7222

@tanstack/react-router

npm i https://pkg.pr.new/@tanstack/react-router@7222

@tanstack/react-router-devtools

npm i https://pkg.pr.new/@tanstack/react-router-devtools@7222

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@7222

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@7222

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@7222

@tanstack/react-start-rsc

npm i https://pkg.pr.new/@tanstack/react-start-rsc@7222

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@7222

@tanstack/router-cli

npm i https://pkg.pr.new/@tanstack/router-cli@7222

@tanstack/router-core

npm i https://pkg.pr.new/@tanstack/router-core@7222

@tanstack/router-devtools

npm i https://pkg.pr.new/@tanstack/router-devtools@7222

@tanstack/router-devtools-core

npm i https://pkg.pr.new/@tanstack/router-devtools-core@7222

@tanstack/router-generator

npm i https://pkg.pr.new/@tanstack/router-generator@7222

@tanstack/router-plugin

npm i https://pkg.pr.new/@tanstack/router-plugin@7222

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@7222

@tanstack/router-utils

npm i https://pkg.pr.new/@tanstack/router-utils@7222

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/@tanstack/router-vite-plugin@7222

@tanstack/solid-router

npm i https://pkg.pr.new/@tanstack/solid-router@7222

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/@tanstack/solid-router-devtools@7222

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@7222

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@7222

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@7222

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@7222

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@7222

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@7222

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@7222

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@7222

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/@tanstack/start-static-server-functions@7222

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@7222

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@7222

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@7222

@tanstack/vue-router

npm i https://pkg.pr.new/@tanstack/vue-router@7222

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/@tanstack/vue-router-devtools@7222

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@7222

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@7222

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@7222

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@7222

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@7222

commit: 1773b3c

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@e2e/react-start/rsc/vite.config.ts`:
- Around line 6-12: The code sets outDir using nullish coalescing (const outDir
= process.env.E2E_DIST_DIR ?? 'dist'), which treats an empty string as a valid
value and can diverge from the shell start script; change the expression to use
the logical OR operator so that process.env.E2E_DIST_DIR || 'dist' is used
instead, ensuring empty strings also fall back to 'dist' (update the const
outDir initialization in vite.config.ts).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 656d486f-f301-4c0c-9c9c-2fe9f46911d0

📥 Commits

Reviewing files that changed from the base of the PR and between 24b11a9 and 1773b3c.

📒 Files selected for processing (3)
  • e2e/react-start/rsc/.gitignore
  • e2e/react-start/rsc/package.json
  • e2e/react-start/rsc/vite.config.ts

Comment on lines +6 to +12
const outDir = process.env.E2E_DIST_DIR ?? 'dist'

export default defineConfig({
resolve: { tsconfigPaths: true },
build: {
outDir,
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Confirm the config/start default semantics differ for empty E2E_DIST_DIR.
# Expected: package script uses "dist" for an empty var; the current Vite config expression would not.

node - <<'NODE'
process.env.E2E_DIST_DIR = ''
console.log('vite outDir with ??:', JSON.stringify(process.env.E2E_DIST_DIR ?? 'dist'))
console.log('vite outDir with ||:', JSON.stringify(process.env.E2E_DIST_DIR || 'dist'))
NODE

E2E_DIST_DIR='' sh -c 'printf "shell start path: %s\n" "${E2E_DIST_DIR:-dist}/server/server.js"'

Repository: TanStack/router

Length of output: 150


🏁 Script executed:

# Search for E2E_DIST_DIR usage across the repository
rg "E2E_DIST_DIR" --type ts --type tsx --type json --type sh -B 2 -A 2

Repository: TanStack/router

Length of output: 86


🏁 Script executed:

# Check the referenced package.json to confirm the context
fd "package.json" e2e/react-start/rsc -exec cat {} \;

Repository: TanStack/router

Length of output: 205


🏁 Script executed:

# Look for other vite.config files in e2e tests to see if they have similar patterns
fd "vite.config" e2e -type f -exec cat {} \;

Repository: TanStack/router

Length of output: 229


🏁 Script executed:

# Search for E2E_DIST_DIR usage across the repository
rg "E2E_DIST_DIR" -B 2 -A 2

Repository: TanStack/router

Length of output: 7210


🏁 Script executed:

# Check the referenced package.json to confirm the context
cat e2e/react-start/rsc/package.json

Repository: TanStack/router

Length of output: 1482


🏁 Script executed:

# Look for other vite.config files in e2e tests to see if they have similar patterns
find e2e -name "vite.config.ts" -o -name "vite.config.js"

Repository: TanStack/router

Length of output: 5627


Use || operator to match the shell parameter expansion semantics in the start script.

Line 6 uses ?? (nullish coalescing), which treats empty strings as valid values. When E2E_DIST_DIR='', the build.outDir becomes an empty string. However, the start script in package.json line 11 uses ${E2E_DIST_DIR:-dist} (shell parameter expansion), which falls back to dist for both unset and empty values. To avoid build and start path divergence, normalize empty strings here too using the || operator.

Proposed fix
-const outDir = process.env.E2E_DIST_DIR ?? 'dist'
+const outDir = process.env.E2E_DIST_DIR || 'dist'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const outDir = process.env.E2E_DIST_DIR ?? 'dist'
export default defineConfig({
resolve: { tsconfigPaths: true },
build: {
outDir,
},
const outDir = process.env.E2E_DIST_DIR || 'dist'
export default defineConfig({
resolve: { tsconfigPaths: true },
build: {
outDir,
},
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e/react-start/rsc/vite.config.ts` around lines 6 - 12, The code sets outDir
using nullish coalescing (const outDir = process.env.E2E_DIST_DIR ?? 'dist'),
which treats an empty string as a valid value and can diverge from the shell
start script; change the expression to use the logical OR operator so that
process.env.E2E_DIST_DIR || 'dist' is used instead, ensuring empty strings also
fall back to 'dist' (update the const outDir initialization in vite.config.ts).

@beaussan beaussan merged commit fc3b766 into TanStack:main Apr 18, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant