-
-
Notifications
You must be signed in to change notification settings - Fork 421
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
Implement an internal time type and Clock trait #4149
Conversation
This will add the capacity for the entire engine to mock time during tests. No impact on performance should be noticeable. Fixed boa-dev#4144
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4149 +/- ##
==========================================
+ Coverage 47.24% 53.56% +6.31%
==========================================
Files 476 488 +12
Lines 46892 48923 +2031
==========================================
+ Hits 22154 26204 +4050
+ Misses 24738 22719 -2019 ☔ View full report in Codecov by Sentry. |
A negative duration is invalid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loving the new API!
#[deprecated( | ||
since = "0.21.0", | ||
note = "Use `context.clock().now().millis_since_epoch()` instead" | ||
)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooh, I like this! It should make it easier for users to migrate, and maybe we can comment when the deprecated API should be removed e.g. a version after deprecation or something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can always update the note later with more info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll leave the deprecation policy of this repo to the leadership :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me overall :)
…imeout`) implementations (#4130) * Make the HostHooks shareable * `setTimeout`, `setInterval` and `clearInterval` (and the same `clearTimeout`) implementations This adds non-async implementations of the `setTimeout`/`setInterval` API functions. They are by default registered in the context when registering all APIs from `boa_runtime`. * Add timeout jobs to tokio/smol event_loop examples and fix borrow issue * Fix compiling issue in smol_event_loop * Fix documentation generation for job * Implement an internal time type and Clock trait This will add the capacity for the entire engine to mock time during tests. No impact on performance should be noticeable. Fixed #4144 * Retype JsDuration in/out to unsigned A negative duration is invalid. * Rework the PR to merge the clock from #4149 * Rework the PR to merge the clock from #4149 * Fix smol/tokio event loops * Remove unused crate
This will add the capacity for the entire engine to mock time during tests. No impact on performance should be noticeable.
Fixed #4144