Skip to content
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

test: Improve test reliability by replacing real timers with fake timers #983

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dngur9801
Copy link
Contributor

Description

This PR replaces real timers in test code with fake/mock timers to improve test reliability and execution speed.

Changes

  • Replaced setTimeout/setInterval calls with mock timer implementations
  • Added timer mocking library to the test environment
  • Updated affected test cases to use the fake timer API
  • Removed unnecessary waits and delays in tests

Advantages

  • More reliable test execution without timing-related flakiness
  • Faster test execution as we don't need to wait for actual time to pass
  • Better control over timer behavior in test scenarios

@dngur9801 dngur9801 requested a review from raon0211 as a code owner March 11, 2025 16:23
Copy link

vercel bot commented Mar 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
es-toolkit ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 11, 2025 4:45pm

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.40%. Comparing base (83d9d2d) to head (b637cc8).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #983   +/-   ##
=======================================
  Coverage   99.40%   99.40%           
=======================================
  Files         381      381           
  Lines        3371     3371           
  Branches     1002     1002           
=======================================
  Hits         3351     3351           
  Misses         19       19           
  Partials        1        1           
🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants