Skip to content

chore: stabilize tests#7185

Merged
schiller-manuel merged 1 commit intomainfrom
stabilize-tests-2
Apr 13, 2026
Merged

chore: stabilize tests#7185
schiller-manuel merged 1 commit intomainfrom
stabilize-tests-2

Conversation

@schiller-manuel
Copy link
Copy Markdown
Contributor

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

Summary by CodeRabbit

  • Refactor

    • Improved drawing functionality implementation for better performance.
  • Tests

    • Enhanced test utilities and assertions for drawing functionality.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 13, 2026

📝 Walkthrough

Walkthrough

This PR optimizes the drawing canvas implementation by switching from React state to a mutable ref for tracking mouse drawing state, and refactors E2E tests with a new helper function to reduce code duplication and simplify stroke-count assertions.

Changes

Cohort / File(s) Summary
Canvas State Management
e2e/react-start/rsc/src/routes/rsc-ssr-false.tsx
Replaced React state (isDrawing) with mutable ref (isDrawingRef) to track mouse drawing state, with initialization in setup and updates in startDrawing/stopDrawing handlers.
Test Helper Refactoring
e2e/react-start/rsc/tests/rsc-ssr-false.spec.ts
Added Point type and drawStroke() helper function to generate synthetic mouse events; consolidated repeated mouse interactions and simplified stroke-count assertions across multiple test cases.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A ref, not state, keeps drawing fleet,
No re-renders to skip a beat,
Test helpers now make strokes so neat,
Mouse events flow with rhythmic feet! 🎨✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% 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 'chore: stabilize tests' directly describes the pull request's primary objective of improving test reliability through code refactoring.

✏️ 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-2

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

View your CI Pipeline Execution ↗ for commit 2fb51c8

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

☁️ Nx Cloud last updated this comment at 2026-04-13 23:06:23 UTC

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

1 package(s) bumped directly, 4 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/react-router 1.168.19 → 1.168.20 Changeset
@tanstack/react-start 1.167.37 → 1.167.38 Dependent
@tanstack/react-start-client 1.166.36 → 1.166.37 Dependent
@tanstack/react-start-rsc 0.0.16 → 0.0.17 Dependent
@tanstack/react-start-server 1.166.37 → 1.166.38 Dependent

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 13, 2026

More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: 2fb51c8

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/tests/rsc-ssr-false.spec.ts`:
- Line 28: The helper functions (e.g., drawStroke) currently declare page as
any; replace page: any with the Playwright Page type (imported from 'playwright'
or '@playwright/test' as used in this repo) to restore type safety, update all
helpers in this file that use page (such as drawStroke and any other
drawing/navigation helpers) to accept page: Page, and ensure the Page import is
added at the top of the file and any Point type usages remain compatible.
🪄 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: 227e7ea7-7db1-49e0-88a5-6493d8f6eb3a

📥 Commits

Reviewing files that changed from the base of the PR and between c5ad329 and 2fb51c8.

📒 Files selected for processing (2)
  • e2e/react-start/rsc/src/routes/rsc-ssr-false.tsx
  • e2e/react-start/rsc/tests/rsc-ssr-false.spec.ts

})
}

async function drawStroke(page: any, start: Point, end: Point) {
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
# Verify weakly typed Playwright page params in this spec
rg -nP '\bpage\s*:\s*any\b' e2e/react-start/rsc/tests/rsc-ssr-false.spec.ts

Repository: TanStack/router

Length of output: 181


Replace page: any with Playwright Page type in helper functions.

Multiple helper functions use page: any, weakening type safety. Type them as Page instead.

🔧 Proposed fix
-import { expect } from '@playwright/test'
+import { expect, type Page } from '@playwright/test'
@@
-  async function clearDrawingStorage(page: any) {
+  async function clearDrawingStorage(page: Page) {
@@
-  async function drawStroke(page: any, start: Point, end: Point) {
+  async function drawStroke(page: Page, start: Point, end: Point) {

Per coding guidelines: **/*.{ts,tsx}: Use TypeScript strict mode with extensive type safety.

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

In `@e2e/react-start/rsc/tests/rsc-ssr-false.spec.ts` at line 28, The helper
functions (e.g., drawStroke) currently declare page as any; replace page: any
with the Playwright Page type (imported from 'playwright' or '@playwright/test'
as used in this repo) to restore type safety, update all helpers in this file
that use page (such as drawStroke and any other drawing/navigation helpers) to
accept page: Page, and ensure the Page import is added at the top of the file
and any Point type usages remain compatible.

@schiller-manuel schiller-manuel merged commit c3d5259 into main Apr 13, 2026
7 checks passed
@schiller-manuel schiller-manuel deleted the stabilize-tests-2 branch April 13, 2026 23:07
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