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: use fake timers in tests #69

Merged

Conversation

adamhamlin
Copy link
Contributor

Tip

The owner of this PR can publish a preview release by commenting /publish in this PR. Afterwards, anyone can try it out by running pnpm add radashi@pr<PR_NUMBER>.

Summary

Speeds up test runs by ~5-10 seconds by using Vitest fake timers to simulate the passage of time.

Before:
Screenshot 2024-07-02 at 11 50 41 PM

After:
Screenshot 2024-07-02 at 11 49 27 PM

Related issue, if any:

Resolves #21

For any code change,

  • Related documentation has been updated, if needed
  • Related tests have been added or updated, if needed
  • Related benchmarks have been added or updated, if needed

Does this PR introduce a breaking change?

No

@adamhamlin adamhamlin requested a review from aleclarson as a code owner July 3, 2024 04:02
@adamhamlin adamhamlin force-pushed the chore/use-fake-timers-async-tests branch from 7752af8 to 7e55493 Compare July 3, 2024 04:05
@aleclarson aleclarson added upstream fix Fixes a bug that existed in Radash maintenance An improvement to codebase maintainability labels Jul 3, 2024
Copy link
Member

@aleclarson aleclarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect. Thanks for tackling this, Adam. 👍

@aleclarson aleclarson changed the title chore: use fake timers in tests test: use fake timers in tests Jul 3, 2024
@aleclarson aleclarson merged commit 119e9f0 into radashi-org:main Jul 3, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance An improvement to codebase maintainability upstream fix Fixes a bug that existed in Radash
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stop using real timeouts in async.test.ts
2 participants