-
Notifications
You must be signed in to change notification settings - Fork 80
Standardize timer advancement patterns in tests for improved consistency #1747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
…ency Co-authored-by: manudeli <[email protected]>
People can be co-author:
|
Size Change: 0 B Total Size: 80.2 kB ℹ️ View Unchanged
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1747 +/- ##
=======================================
Coverage 73.71% 73.71%
=======================================
Files 80 80
Lines 780 780
Branches 164 164
=======================================
Hits 575 575
Misses 196 196
Partials 9 9
🚀 New features to boost your workflow:
|
@copilot rebase please |
Co-authored-by: Jonghyeon Ko <[email protected]>
# Overview <!-- A clear and concise description of what this pr is about. --> - Removed an unnecessary key prop usage in the example React component. ## PR Checklist - [ ] I did below actions if need 1. I read the [Contributing Guide](https://github.com/toss/suspensive/blob/main/CONTRIBUTING.md) 2. I added documents and tests.
Co-authored-by: Jonghyeon Ko <[email protected]>
…tack-query-import (#1672)
…1760) Co-authored-by: Gwansik Kim <[email protected]> Co-authored-by: Marshall Ku / 구영표 <[email protected]>
Rebased onto latest main. The branch now has a clean linear history without merge commits (d2f5c03). |
Improve test performance by using fake timers instead of real timers
This PR standardizes timer usage patterns across all test files to improve consistency and maintainability, addressing inconsistent timer advancement approaches that were previously mixed throughout the codebase.
Problem
Tests were using inconsistent timer advancement patterns:
vi.advanceTimersByTimeAsync()
(async version)vi.advanceTimersByTime()
(sync version)Solution
Standardized all timer advancement calls to use the synchronous
vi.advanceTimersByTime()
method where appropriate. This change:Changes Made
Jotai Package
Atom.spec.tsx
,AtomValue.spec.tsx
, andSetAtom.spec.tsx
to use sync timer advancementReact Package
lazy.spec.tsx
to use sync timer advancement consistentlyExample Change
This works correctly because all affected tests already properly use fake timers (
vi.useFakeTimers()
) and thesleep()
functions usesetTimeout
which respects fake timers. The sync version is sufficient for these test scenarios as no complex async promise coordination is required.Verification
Fixes #1448.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.