Sitelet https://github.com/getsentry/sentry-javascript/pull/25211
Skip to content

test(core): Fix flaky span end timestamp test - #25211

Merged
Lms24 merged 3 commits into
developfrom
fix/core-flaky-span-end-test
Oct 9, 2026
Merged

Lms24 merged 3 commits into
developfrom
fix/core-flaky-span-end-test

Conversation

@Lms24

@Lms24 Lms24 commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Since #24903 a span's end time is its start time plus the performance.now() duration, which can differ from a timestampInSeconds() value taken mid-span by fractions of a microsecond in either direction. Basically because a double can't reliably hold the very minimal time difference here. This PR relaxes the test assertion a bit while still asserting that the span ended at the current time.

Since #24903, a span's end time is its start time plus the
`performance.now()` duration. It can differ from a `timestampInSeconds()`
value taken while the span runs by fractions of a microsecond in either
direction, so `toBeGreaterThanOrEqual(now)` failed in about 15% of runs.

Assert what the code guarantees instead: the end time is never before
the start time, and it is close to the current time.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Lms24 Lms24 self-assigned this Oct 9, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Lms24
Lms24 marked this pull request as ready for review October 9, 2026 09:03
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Lms24
Lms24 requested review from msonnb and nicohrubec October 9, 2026 10:12
@Lms24
Lms24 merged commit e144978 into develop Oct 9, 2026
360 checks passed
@Lms24
Lms24 deleted the fix/core-flaky-span-end-test branch October 9, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants