Implement an internal time type and Clock trait#4149
Merged
jedel1043 merged 2 commits intoboa-dev:mainfrom Feb 1, 2025
Merged
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.
hansl
added a commit
to hansl/boa
that referenced
this pull request
Jan 27, 2025
hansl
added a commit
to hansl/boa
that referenced
this pull request
Jan 27, 2025
jedel1043
approved these changes
Jan 31, 2025
Comment on lines
+185
to
+188
| #[deprecated( | ||
| since = "0.21.0", | ||
| note = "Use `context.clock().now().millis_since_epoch()` instead" | ||
| )] |
Member
There was a problem hiding this comment.
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.
Contributor
Author
There was a problem hiding this comment.
We can always update the note later with more info.
Contributor
Author
There was a problem hiding this comment.
I'll leave the deprecation policy of this repo to the leadership :)
github-merge-queue bot
pushed a commit
that referenced
this pull request
Feb 3, 2025
…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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This will add the capacity for the entire engine to mock time during tests. No impact on performance should be noticeable.
Fixed #4144