test(virtual-core): split index.test.ts into topic files #1328
main fromrefs/pull/1328/head·merged by piecyk 🎯 Changes#
packages/virtual-core/tests/index.test.ts had grown to ~7000 lines with ~230 flat tests. This PR moves the tests into one file per topic. Test bodies and names are unchanged.
packages/virtual-core/tests/
-├── index.test.ts # 6985 lines, everything
+├── index.test.ts # exports, lanes, setOptions, takeSnapshot
+├── scroll-commands.test.ts # scrollToIndex/Offset/By, reconcile, cancelScroll, read-backs
+├── measurement.test.ts # resizeItem, measure(), ResizeObserver cache + batching
+├── range.test.ts # defaultRangeExtractor, lazy fast path
+├── ios-deferral.test.ts # iOS deferred corrections, touch phases, Phase 2a/2b, #1250
+├── ios-fling-wait.test.ts # iOS 27 commands that wait for a fling tail
+├── adjustment.test.ts # scroll-up jank, self-write direction latch, #1218
+├── anchor-end.test.ts # anchorTo end, followOnAppend, #1229, #1258
+├── dom-observers.test.ts # elementScroll/windowScroll, observeElement/WindowOffset
+├── helpers.ts # helpers used by more than one file
├── ios-gesture.test.ts # (unchanged)
├── prepend-hold.test.ts # (unchanged)
└── ...
- Each top-level block (test, helper, section comment) moved whole, by line range.
- Only 3 helpers are used by more than one file and move to
helpers.tswithexport:withFakeIOSUserAgent,makeDeferralHarness,makeMockScrollElement. All other helpers stay next to their tests.
Evidence#
- Before: vitest on
main→ 408 tests, 407 passed, 1 skipped. After: vitest on this branch → 408 tests, 407 passed, 1 skipped. The set of(fullName, status)pairs is identical. - Every non-blank line of the old file appears exactly once in the new files. The only edit is the
exportkeyword on the 3 shared helpers. - A type check that includes
tests/gives the same error count before and after (the existing errors come from loose test mocks;tests/is not part oftest:types).
Merge Danger#
Door: two-way
Tests only. A revert restores the single file.
Blast Radius: open-PRs
No published code changes. Open PRs that edit index.test.ts will conflict and need a rebase that moves their new tests into the matching topic file:
✅ Checklist#
- I have followed the steps in the Contributing guide.
- I have tested this code locally with
pnpm run test:pr.
🚀 Release Impact#
- This change affects published code, and I have generated a changeset.
- This change is docs/CI/dev-only (no release).
🤖 Generated with Claude Code
Summary by CodeRabbit#
- Tests
- Expanded coverage for virtualized list scrolling, including scroll adjustments, anchoring, end-follow behavior, and scroll commands.
- Added tests for iOS touch and fling behavior, measurement updates, range extraction, DOM observers, and cleanup.
- 1
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
0a9c4e94-e7b9-4215-9290-5b346c5c022d
📥 Commits
-
Reviewing files that changed from the base of the PR and between 77cb05eef131699bcef0f0a5877b60503e54a366 and 7b77c3e49662b09f8fd157c4b8837296602e9c4a.
📒 Files selected for processing: 10
-
packages/virtual-core/tests/adjustment.test.tspackages/virtual-core/tests/anchor-end.test.tspackages/virtual-core/tests/dom-observers.test.tspackages/virtual-core/tests/helpers.tspackages/virtual-core/tests/index.test.tspackages/virtual-core/tests/ios-deferral.test.tspackages/virtual-core/tests/ios-fling-wait.test.tspackages/virtual-core/tests/measurement.test.tspackages/virtual-core/tests/range.test.tspackages/virtual-core/tests/scroll-commands.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
-
📝 Walkthrough
-
This pull request adds virtual-core tests for measurement, scroll adjustment and commands, end anchoring, DOM observers, and iOS touch and fling handling.
Changes: Virtualizer behavior coverage
Layer / File(s) Summary Measurement and range access
packages/virtual-core/tests/measurement.test.ts,packages/virtual-core/tests/range.test.tsTests cover measurement cache updates, ResizeObserver behavior, lazy measurements, and range extraction. DOM scroll observers
packages/virtual-core/tests/dom-observers.test.tsTests cover scroll calls and offsets, listener cleanup, and virtualizer scroll-state resets. Scroll adjustment behavior
packages/virtual-core/tests/adjustment.test.tsTests cover adjustment direction, read-backs, notification timing, and measurements of viewport-spanning items. Scroll command reconciliation
packages/virtual-core/tests/scroll-commands.test.tsTests cover command targets, reconciliation and cancellation, end alignment, measurement changes, and scroll-element replacement. End anchoring and append behavior
packages/virtual-core/tests/anchor-end.test.tsTests cover reading-anchor preservation, append following, end-distance calculations, and retries for clamped anchor writes. iOS scroll deferral and fling handling
packages/virtual-core/tests/helpers.ts,packages/virtual-core/tests/ios-deferral.test.ts,packages/virtual-core/tests/ios-fling-wait.test.tsHelpers and tests cover deferred corrections, touch and momentum states, queued index commands, fling outcomes, and cleanup. Priority: ⬇️ Low
Estimated code review effort: 4 (Complex) | ~60 minutes
Change: Other
Merge Risk: ⚪ Minimal · up to
7b77c-
This change only reorganizes the virtual-core test suite into topic-based files, with no change to library code or published behavior. It carries no meaningful merge risk.
Pre-merge checks:
4 · 1-
Failed checks: 1 warningCheck name Status Explanation Resolution Docstring Coverage Docstring coverage is 72.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 25 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold. Passed checks: 4 passed-
Check name Status Explanation Title check The title clearly and concisely describes the main change: splitting the monolithic virtual-core test file into topic-specific files. Description check The description explains the scope, motivation, file organization, validation results, merge impact, checklist, and release impact. The checklist boxes remain unchecked, but the required information i… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request.
-
- Fix all pre-merge checks with AI
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
🔧 ESLint
-
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
packages/virtual-core/tests/adjustment.test.ts
-
Parsing error: "parserOptions.project" has been provided for
@typescript-eslint/parser. The file was not found in any of the provided project(s): packages/virtual-core/tests/adjustment.test.ts
packages/virtual-core/tests/anchor-end.test.ts
-
Parsing error: "parserOptions.project" has been provided for
@typescript-eslint/parser. The file was not found in any of the provided project(s): packages/virtual-core/tests/anchor-end.test.ts
packages/virtual-core/tests/dom-observers.test.ts
-
Parsing error: "parserOptions.project" has been provided for
@typescript-eslint/parser. The file was not found in any of the provided project(s): packages/virtual-core/tests/dom-observers.test.ts
- 6 others
-
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.
Comment `@coderabbitai help` to get the list of available commands.-
View your CI Pipeline Execution ↗ for commit 7b77c3e49662b09f8fd157c4b8837296602e9c4a
Command Status Duration Result nx affected --targets=test:sherif,test:knip,tes...✅ Succeeded 4m 15s View ↗ nx run-many --target=build --exclude=examples/**✅ Succeeded 20s View ↗
☁️ Nx Cloud last updated this comment at
2026-10-15 06:47:57UTCMore templates
- @tanstack/virtual-example-angular-chat
- @tanstack/virtual-example-angular-dynamic
- @tanstack/virtual-example-angular-fixed
- @tanstack/virtual-example-angular-infinite-scroll
- @tanstack/virtual-example-angular-padding
- @tanstack/virtual-example-angular-smooth-scroll
- @tanstack/virtual-example-angular-sticky
- @tanstack/virtual-example-angular-table
- @tanstack/virtual-example-angular-variable
- @tanstack/virtual-example-angular-window
- tanstack-lit-virtual-example-dynamic
- tanstack-lit-virtual-example-fixed
- tanstack-marko-virtual-example-chat
- tanstack-marko-virtual-example-chat-pretext
- tanstack-marko-virtual-example-dynamic
- tanstack-marko-virtual-example-fixed
- tanstack-marko-virtual-example-grid
- tanstack-marko-virtual-example-infinite-scroll
- tanstack-marko-virtual-example-padding
- tanstack-marko-virtual-example-pretext
- tanstack-marko-virtual-example-scroll-padding
- tanstack-marko-virtual-example-smooth-scroll
- tanstack-marko-virtual-example-ssr
- tanstack-marko-virtual-example-ssr-fetch
- tanstack-marko-virtual-example-ssr-restore
- tanstack-marko-virtual-example-ssr-slice
- tanstack-marko-virtual-example-sticky
- tanstack-marko-virtual-example-table
- tanstack-marko-virtual-example-variable
- tanstack-marko-virtual-example-window
- tanstack-marko-virtual-example-window-ssr-slice
- tanstack-react-virtual-example-chat
- tanstack-react-virtual-example-dynamic
- tanstack-react-virtual-example-fixed
- tanstack-react-virtual-example-infinite-scroll
- tanstack-react-virtual-example-padding
- tanstack-react-virtual-example-pretext
- tanstack-react-virtual-example-scroll-padding
- tanstack-react-virtual-example-smooth-scroll
- tanstack-react-virtual-example-sticky
- tanstack-react-virtual-example-table
- tanstack-react-virtual-example-variable
- tanstack-react-virtual-example-window
- tanstack-svelte-virtual-example-dynamic
- tanstack-svelte-virtual-example-fixed
- tanstack-svelte-virtual-example-infinite-scroll
- tanstack-svelte-virtual-example-smooth-scroll
- tanstack-svelte-virtual-example-sticky
- tanstack-svelte-virtual-example-table
- tanstack-vue-virtual-example-dynamic
- tanstack-vue-virtual-example-fixed
- tanstack-vue-virtual-example-infinite-scroll
- tanstack-vue-virtual-example-padding
- tanstack-vue-virtual-example-scroll-padding
- tanstack-vue-virtual-example-smooth-scroll
- tanstack-vue-virtual-example-sticky
- tanstack-vue-virtual-example-table
- tanstack-vue-virtual-example-variable
@tanstack/angular-virtual
npm i https://pkg.pr.new/@tanstack/angular-virtual@1328@tanstack/lit-virtual
npm i https://pkg.pr.new/@tanstack/lit-virtual@1328@tanstack/marko-virtual
npm i https://pkg.pr.new/@tanstack/marko-virtual@1328@tanstack/react-virtual
npm i https://pkg.pr.new/@tanstack/react-virtual@1328@tanstack/solid-virtual
npm i https://pkg.pr.new/@tanstack/solid-virtual@1328@tanstack/svelte-virtual
npm i https://pkg.pr.new/@tanstack/svelte-virtual@1328@tanstack/virtual-core
npm i https://pkg.pr.new/@tanstack/virtual-core@1328@tanstack/vue-virtual
npm i https://pkg.pr.new/@tanstack/vue-virtual@1328commit:
7b77c3epiecyk merged this16c786a
piecyk closed this
Sign in to join this conversation.
⚠️ No Changeset found#
Latest commit: 7b77c3e49662b09f8fd157c4b8837296602e9c4a
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR