test(svelte-query): align 'advanceTimersByTimeAsync' with 'sleep' duration in wait-for-fire cases#10908
Conversation
…ation in wait-for-fire cases
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthroughThis PR adjusts fake-timer advancements across nine svelte-query test files to use exact durations matching the mocked operation times, reducing overshoot from 1–2ms wait intervals to zero. ChangesTest Fake-Timer Synchronization
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
View your CI Pipeline Execution ↗ for commit 5e23635
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version PreviewNo changeset entries found. Merging this PR will not cause a version bump for any packages. |
size-limit report 📦
|
🎯 Changes
Where a test advances fake timers solely to wait for a
sleep(N)timer to fire and deliver data/state, align thevi.advanceTimersByTimeAsync(...)value with the correspondingsleepduration:sleep(10)→advanceTimersByTimeAsync(10)(was11)sleep(20)→advanceTimersByTimeAsync(20)(was21)sleep(50)→advanceTimersByTimeAsync(50)(was51)sleep(500)→advanceTimersByTimeAsync(500)(was501)A
setTimeout(fn, N)(whichsleepuses) fires exactly atNms, soadvanceTimersByTimeAsync(N)is enough to flush it and the following microtasks; the extra+1was unnecessary.Threshold-crossing advances (e.g.
staleTimeboundaries that compare with strict>) are intentionally left as-is, since those genuinely need to advance past the boundary.✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit