Skip to content

stabilize rsc tests#7217

Merged
schiller-manuel merged 1 commit intomainfrom
stabilize-tests-rsc
Apr 17, 2026
Merged

stabilize rsc tests#7217
schiller-manuel merged 1 commit intomainfrom
stabilize-tests-rsc

Conversation

@schiller-manuel
Copy link
Copy Markdown
Contributor

@schiller-manuel schiller-manuel commented Apr 17, 2026

Summary by CodeRabbit

  • Tests
    • Refactored test infrastructure by consolidating hydration verification checks into a shared utility function, improving consistency and maintainability across the test suite.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 17, 2026

📝 Walkthrough

Walkthrough

A new helper function waitForHydration(page: Page) is created to centralize hydration synchronization logic. All 30+ test files across the RSC test suite are updated to import and use this shared utility instead of inline Playwright assertions for checking the hydrated state.

Changes

Cohort / File(s) Summary
Hydration Helper Creation
e2e/react-start/rsc/tests/hydration.ts
New exported helper function waitForHydration() that awaits an assertion checking if the app-hydrated element contains "hydrated" text with a 15-second timeout.
Test Suite Updates
e2e/react-start/rsc/tests/rsc-*.spec.ts
Consistent pattern applied across all test files: add waitForHydration import from ./hydration and replace direct Playwright assertions (expect(page.getByTestId('app-hydrated')).toHaveText('hydrated')) with await waitForHydration(page) calls to centralize hydration synchronization logic.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A hydration helper hops into view,
No more text checks scattered askew,
Thirty tests now share the same tune,
Waiting together—hydration's bright moon!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'stabilize rsc tests' accurately reflects the main objective of the pull request, which is to improve test stability by extracting hydration logic into a reusable helper function and updating all RSC test files to use it consistently.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch stabilize-tests-rsc

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 17, 2026

View your CI Pipeline Execution ↗ for commit 9559a4d

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

☁️ Nx Cloud last updated this comment at 2026-04-17 17:57:27 UTC

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 17, 2026

More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: 9559a4d

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: 2

🤖 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/tests/hydration.ts`:
- Line 1: The import currently mixes a value and a type specifier inline; split
them into two top-level imports to satisfy the lint rule: keep the value import
for expect as import { expect } from '@playwright/test' and add a separate
top-level type-only import import type { Page } from '@playwright/test' so the
type Page is imported with the "type" specifier on its own import declaration.

In `@e2e/react-start/rsc/tests/rsc-deferred.spec.ts`:
- Around line 3-4: Add a blank line after the import statement to satisfy the
import/newline-after-import rule: separate the import of waitForHydration from
the constant declaration DEFERRED_DATA_TIMEOUT by inserting an empty line after
the import so the file's top-of-file imports and subsequent declarations are
visually and lint-wise separated.
🪄 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: 3facdf98-973b-4992-957b-07d333897fe2

📥 Commits

Reviewing files that changed from the base of the PR and between e2332b0 and 9559a4d.

📒 Files selected for processing (30)
  • e2e/react-start/rsc/tests/hydration.ts
  • e2e/react-start/rsc/tests/rsc-async-bundle.spec.ts
  • e2e/react-start/rsc/tests/rsc-basic.spec.ts
  • e2e/react-start/rsc/tests/rsc-bundle.spec.ts
  • e2e/react-start/rsc/tests/rsc-caching.spec.ts
  • e2e/react-start/rsc/tests/rsc-client-preload.spec.ts
  • e2e/react-start/rsc/tests/rsc-component-slot.spec.ts
  • e2e/react-start/rsc/tests/rsc-context.spec.ts
  • e2e/react-start/rsc/tests/rsc-css-modules.spec.ts
  • e2e/react-start/rsc/tests/rsc-deferred.spec.ts
  • e2e/react-start/rsc/tests/rsc-forms.spec.ts
  • e2e/react-start/rsc/tests/rsc-global-css.spec.ts
  • e2e/react-start/rsc/tests/rsc-hydration.spec.ts
  • e2e/react-start/rsc/tests/rsc-link.spec.ts
  • e2e/react-start/rsc/tests/rsc-nested-structure.spec.ts
  • e2e/react-start/rsc/tests/rsc-nested.spec.ts
  • e2e/react-start/rsc/tests/rsc-parallel-flash.spec.ts
  • e2e/react-start/rsc/tests/rsc-param-remount.spec.ts
  • e2e/react-start/rsc/tests/rsc-react-cache.spec.ts
  • e2e/react-start/rsc/tests/rsc-server-not-found.spec.ts
  • e2e/react-start/rsc/tests/rsc-server-redirect.spec.ts
  • e2e/react-start/rsc/tests/rsc-slot-jsx-args.spec.ts
  • e2e/react-start/rsc/tests/rsc-slots.spec.ts
  • e2e/react-start/rsc/tests/rsc-ssr-data-only.spec.ts
  • e2e/react-start/rsc/tests/rsc-ssr-false.spec.ts
  • e2e/react-start/rsc/tests/rsc-stream-flash.spec.ts
  • e2e/react-start/rsc/tests/rsc-stream-generator.spec.ts
  • e2e/react-start/rsc/tests/rsc-stream-readable.spec.ts
  • e2e/react-start/rsc/tests/rsc-suspense.spec.ts
  • e2e/react-start/rsc/tests/rsc-tree.spec.ts

@@ -0,0 +1,7 @@
import { expect, type Page } from '@playwright/test'
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
set -euo pipefail

# Verify relevant lint rules are configured in repo lint files
rg -n --iglob '*eslint*' 'import/consistent-type-specifier-style|sort-imports'

# Verify current import in hydration helper
rg -n "import \{ expect, type Page \} from '@playwright/test'" e2e/react-start/rsc/tests/hydration.ts

Repository: TanStack/router

Length of output: 41


🏁 Script executed:

# Check if file exists and read the actual import
cat -n e2e/react-start/rsc/tests/hydration.ts | head -20

Repository: TanStack/router

Length of output: 315


🏁 Script executed:

# Find ESLint configuration files in the repo
find . -maxdepth 3 -type f \( -name ".eslintrc*" -o -name "eslint.config.*" \) | head -20

Repository: TanStack/router

Length of output: 916


🏁 Script executed:

# Search for import-related lint rules more broadly
rg -A 5 -B 5 "import/consistent-type-specifier-style|sort-imports" --type-list | head -50

Repository: TanStack/router

Length of output: 448


🏁 Script executed:

# Read root ESLint config
cat ./eslint.config.js | head -100

Repository: TanStack/router

Length of output: 818


🏁 Script executed:

# Read e2e ESLint config
cat ./e2e/eslint-plugin-start/eslint.config.js

Repository: TanStack/router

Length of output: 645


🏁 Script executed:

# Check for any other e2e related eslint configs
find ./e2e -type f -name "eslint.config.*"

Repository: TanStack/router

Length of output: 342


🏁 Script executed:

# Search for import-related rules in the codebase
rg "import/consistent-type-specifier-style|sort-imports|simple-import-sort" . --type-list 2>/dev/null | head -30

Repository: TanStack/router

Length of output: 41


🏁 Script executed:

# Try to find where `@tanstack/eslint-config` is defined or check imports in root config
rg "import/consistent-type-specifier-style|type.*import" --type js --type ts . | head -30

Repository: TanStack/router

Length of output: 3853


🏁 Script executed:

# Check the specific e2e/react-start/rsc/eslint.config.js config
cat ./e2e/react-start/rsc/eslint.config.js

Repository: TanStack/router

Length of output: 617


🏁 Script executed:

# Search for any ESLint comments or disable directives in the hydration.ts file
cat -n e2e/react-start/rsc/tests/hydration.ts

Repository: TanStack/router

Length of output: 315


🏁 Script executed:

# Check if `@tanstack/eslint-config` has type-import rules
rg "import/consistent-type-specifier-style" . --type js --type ts

Repository: TanStack/router

Length of output: 41


🏁 Script executed:

# Check if there's a parent or global eslint config for e2e tests
find ./e2e -name ".eslintignore" -o -name "eslint.config.*" | xargs ls -la 2>/dev/null

Repository: TanStack/router

Length of output: 636


🏁 Script executed:

# Search for any eslint overrides or configs that might target tests or hydration.ts
rg "tests.*hydration|hydration\.ts" . --type js --type ts --type json

Repository: TanStack/router

Length of output: 553


🏁 Script executed:

# Check if there's any playwright-specific eslint config or rules
rg "playwright|@playwright" . --type js --type ts -A 3 | grep -i "rule\|config" | head -20

Repository: TanStack/router

Length of output: 1668


🏁 Script executed:

# Check what rules `@tanstack/eslint-config` exports (look for it in node_modules or package.json)
rg "tanstack.*eslint.*config" . --type json -A 3 | head -30

Repository: TanStack/router

Length of output: 905


🏁 Script executed:

# Check if there are any eslint overrides or additional configs in root eslint.config.js that might apply to test files
cat ./eslint.config.js | grep -A 20 -B 5 "test\|e2e"

Repository: TanStack/router

Length of output: 41


🏁 Script executed:

# Look for any other ESLint configs in parent directories or check if test files have any lint rules
rg "import.*type|type.*import" e2e/react-start/rsc/tests/ --type ts -B 2 -A 2

Repository: TanStack/router

Length of output: 1317


🏁 Script executed:

# Check if other test files in same directory use the same pattern
rg "import.*type.*from.*@playwright/test" e2e/react-start/rsc/tests/ -l

Repository: TanStack/router

Length of output: 141


🏁 Script executed:

# Verify the root eslint.config.js doesn't have any overrides for test files
cat ./eslint.config.js

Repository: TanStack/router

Length of output: 818


🏁 Script executed:

# Check if `@tanstack/eslint-config` actually includes import/consistent-type-specifier-style
npm list `@tanstack/eslint-config` 2>/dev/null || grep "@tanstack/eslint-config" ./package.json

Repository: TanStack/router

Length of output: 738


🏁 Script executed:

# Find and examine the `@tanstack/eslint-config` to see what rules it exports
find ./node_modules -path "*@tanstack/eslint-config*" -name "*.js" -o -path "*@tanstack/eslint-config*" -name "*.ts" | head -10

Repository: TanStack/router

Length of output: 2001


🏁 Script executed:

# Check the actual eslint-config content
cat ./node_modules/.pnpm/@tanstack+eslint-config@0.4.0_@typescript-eslint+utils@8.57.1_eslint@9.22.0_jiti@2.6.1__71a7465028deca506823eb713e9f533e/node_modules/@tanstack/eslint-config/dist/index.js 2>/dev/null | head -200

Repository: TanStack/router

Length of output: 1802


🏁 Script executed:

# Search for import/consistent-type-specifier-style in entire node_modules to see if it's even available
rg "import/consistent-type-specifier-style" ./node_modules --max-count 5 2>/dev/null

Repository: TanStack/router

Length of output: 41


🏁 Script executed:

# Check what import rules are defined in `@tanstack/eslint-config`
cat ./node_modules/.pnpm/@tanstack+eslint-config@0.4.0_@typescript-eslint+utils@8.57.1_eslint@9.22.0_jiti@2.6.1__71a7465028deca506823eb713e9f533e/node_modules/@tanstack/eslint-config/dist/import.js

Repository: TanStack/router

Length of output: 592


🏁 Script executed:

# Check if eslint-plugin-import-x (which is used) has the consistent-type-specifier-style rule
rg "consistent-type-specifier-style" ./node_modules/.pnpm/eslint-plugin-import-x* --max-count 5 2>/dev/null | head -10

Repository: TanStack/router

Length of output: 41


Separate the type import to top level to satisfy lint rules.

The file uses inline type Page specifier which violates the configured import/consistent-type-specifier-style rule (set to "error" with "prefer-top-level" style in @tanstack/eslint-config).

♻️ Proposed fix
-import { expect, type Page } from '@playwright/test'
+import { expect } from '@playwright/test'
+import type { Page } from '@playwright/test'
📝 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
import { expect, type Page } from '@playwright/test'
import { expect } from '@playwright/test'
import type { Page } from '@playwright/test'
🧰 Tools
🪛 ESLint

[error] 1-1: Member 'Page' of the import declaration should be sorted alphabetically.

(sort-imports)


[error] 1-1: Prefer using a top-level type-only import instead of inline type specifiers.

(import/consistent-type-specifier-style)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e/react-start/rsc/tests/hydration.ts` at line 1, The import currently mixes
a value and a type specifier inline; split them into two top-level imports to
satisfy the lint rule: keep the value import for expect as import { expect }
from '@playwright/test' and add a separate top-level type-only import import
type { Page } from '@playwright/test' so the type Page is imported with the
"type" specifier on its own import declaration.

Comment on lines +3 to 4
import { waitForHydration } from './hydration'
const DEFERRED_DATA_TIMEOUT = 5000 // Deferred data takes ~2 seconds
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

Fix lint error: add a blank line after imports.

Line 3 is currently followed by a declaration on Line 4, which violates import/newline-after-import reported by ESLint.

Suggested fix
 import { expect } from '@playwright/test'
 import { test } from '@tanstack/router-e2e-utils'
 import { waitForHydration } from './hydration'
+
 const DEFERRED_DATA_TIMEOUT = 5000 // Deferred data takes ~2 seconds
📝 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
import { waitForHydration } from './hydration'
const DEFERRED_DATA_TIMEOUT = 5000 // Deferred data takes ~2 seconds
import { expect } from '@playwright/test'
import { test } from '@tanstack/router-e2e-utils'
import { waitForHydration } from './hydration'
const DEFERRED_DATA_TIMEOUT = 5000 // Deferred data takes ~2 seconds
🧰 Tools
🪛 ESLint

[error] 3-3: Expected 1 empty line after import statement not followed by another import.

(import/newline-after-import)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e/react-start/rsc/tests/rsc-deferred.spec.ts` around lines 3 - 4, Add a
blank line after the import statement to satisfy the import/newline-after-import
rule: separate the import of waitForHydration from the constant declaration
DEFERRED_DATA_TIMEOUT by inserting an empty line after the import so the file's
top-of-file imports and subsequent declarations are visually and lint-wise
separated.

@schiller-manuel schiller-manuel merged commit c19571f into main Apr 17, 2026
7 checks passed
@schiller-manuel schiller-manuel deleted the stabilize-tests-rsc branch April 17, 2026 19:20
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