Repository navigation
Stop a telemetry test from failing the frontend test run - #4809
Merged
Merged
Conversation
…iles The test starts the real EDOT SDK. Under jsdom, its navigation timing instrumentation retries on a backoff timer. When the worker runs another file after this one, the timer fires against a torn-down environment and Vitest fails the run with `document is not defined`. The test now runs on fake timers, so the pending retry goes away with the test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
akira28
approved these changes
Nov 10, 2026
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4809/ |
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
npmCI job no longer fails on an unhandledReferenceError: document is not definedafter all tests pass. A telemetry test leaked a timer into later test files.Affects: Internals only
Prompt summary: CI is red on an unrelated PR. Find out why the
npmjob fails and fix it.Why
does not read document.cookie while the real SDK startsruns the real EDOT browser SDK. Under jsdom, the navigation timing instrumentation never sees a finished page load, so it retries on a backoff timer. When the same Vitest worker runs another file afterwards, the timer fires against a torn-down environment. Vitest then reports an unhandled error and the job exits with code 1. This failsmainat17b002443, and whether it fails depends on how CI spreads files across workers.What
The test runs on fake timers
The test now calls
vi.useFakeTimers()before it starts the real SDK and restores real timers in afinally. The pending retry is a fake timer, so it goes away with the test. Callingshutdown()on the SDK does not work, because it waits on an export that never finishes under jsdom.Verify
🤖 Generated with Claude Code