Repository navigation
Fix the flaky queue time test in GoogleAnalyticsClient - #3231
Open
RoyEJohnson wants to merge 4 commits into
Open
RoyEJohnson wants to merge 4 commits into
RoyEJohnson wants to merge 4 commits into
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch was successfully deployed
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.
The
GoogleAnalyticsClienttest "saves the commands and sends them after tag IDs set" fails now and then in CI withExpected: >= 5, Received: 4.Cause
The test waits 5 ms with a real
setTimeout, then expectsqueue_timeto be at least 5.queue_timeis measured withDate. A timer can fire a millisecond early compared with theDateclock, and on a busy machine that gives 4.Change
The test now uses jest's modern fake timers, which also fake
Date, and advances them by 5 ms.queue_timeis exactly 5, so the test checks for 5 and no longer depends on the machine. The unusedsleephelper is removed. Only the test changes.Testing
googleAnalyticsClient.spec.tspasses (23 tests), three runs in a row.tscshows no new errors.🤖 Generated with Claude Code