Skip to content

refactor(cli/unstable): use Date.now() internally and use FakeTime for testing #6686

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

Merged
merged 5 commits into from
May 30, 2025

Conversation

timreichen
Copy link
Contributor

Ref: #6684

Seems like the random delay in setData() could lead to tests being flaky.
This PR removes the function altogether and adds additional tests.

@timreichen timreichen requested a review from kt3k as a code owner May 27, 2025 07:33
@github-actions github-actions bot added the cli label May 27, 2025
Copy link

codecov bot commented May 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.70%. Comparing base (55d0efb) to head (c9cd3e5).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6686   +/-   ##
=======================================
  Coverage   94.70%   94.70%           
=======================================
  Files         567      567           
  Lines       46789    46789           
  Branches     6582     6582           
=======================================
  Hits        44310    44310           
  Misses       2437     2437           
  Partials       42       42           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

@kt3k
Copy link
Member

kt3k commented May 28, 2025

@BlackAsLight
Copy link
Contributor

Since your expected results changes based on execution time, you can't have a static expected output. You're going to need something more flexible to confirm the results of the output or it will continue to appear flaky at times.

@timreichen
Copy link
Contributor Author

I updated the ProgressBar class so it uses Date instead of performance internally, so it can be tested with FakeTime. This should give more consistent results.

@timreichen timreichen changed the title refactor(cli/unstable): remove setData() refactor(cli/unstable): use Date.now() internally and use FakeTime for testing May 28, 2025
@timreichen
Copy link
Contributor Author

@kt3k Funnily enough there seems to be a flaky fs/renameSync test that fails here...

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

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

LGTM

@kt3k kt3k merged commit 7c3b502 into denoland:main May 30, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants