test(test-utils): Add Sentry CLI trace helpers as test-utils/cli - #24279
Merged
Merged
Conversation
JPeer264
added this pull request to stack #24281
September 10, 2026 06:29
Contributor
size-limit report 📦
|
JPeer264
marked this pull request as ready for review
September 11, 2026 15:11
JPeer264
force-pushed
the
jp/test-utils-sentry-cli-helpers
branch
from
September 11, 2026 15:13
e333c07 to
e709084
Compare
isaacs
approved these changes
Sep 15, 2026
isaacs
left a comment
Member
There was a problem hiding this comment.
I think the "trace not landed" detection could be improved, but overall it's fine. The other concern (which I'm assuming is addressed in the next PR in the stack, otherwise why would you have done this? lol) is that nothing in the repo imports @sentry-internal/test-utils/cli. But assuming it does, then it's important to have it, and this PR adds it, so that's good ;)
Member
Author
Yeah you're right nothing does. I tried to split it up to make it easier to review :D |
Send-to-sentry E2E apps need to wait until their data is queryable in Sentry. The new subpath export polls through the `sentry` CLI instead of hand-rolled requests against the trace endpoint, and gives the tests a paste-able `sentry trace view` command for debugging. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: isaacs <i@izs.me>
Co-authored-by: isaacs <i@izs.me>
JPeer264
force-pushed
the
jp/test-utils-sentry-cli-helpers
branch
from
September 17, 2026 12:29
3b11e66 to
f6577bc
Compare
This was referenced Sep 21, 2026
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.
Adds
@sentry-internal/test-utils/cli, a helper module for E2E apps that send real data to Sentry and have to wait until it is queryable. It shells out to thesentryCLI (sentry trace view <org>/<project>/<trace> --json --fresh) instead of hand-rolling requests against the organization trace endpoint, and exposesfindErrorInTrace,findSpanInTrace,fetchTrace,flattenTrace,traceTargetandEVENT_POLLING_OPTIONS.Decisions:
sentrypackage on npm), not of test-utils. The helper runspnpm exec sentryin the app's working directory, which keeps the 15 MB CLI out of every other test app.E2E_TEST_AUTH_TOKENto the CLI asSENTRY_AUTH_TOKENand setsSENTRY_FORCE_ENV_TOKEN=1. Without the flag the CLI prefers a developer's stored login over the env token, so local runs would authenticate differently from CI.--freshbypasses the CLI's response cache, which would otherwise defeat polling.org:read.traceTargetreturns the CLI target, so a test can log asentry trace view ...line that is paste-able into a terminal when a CI run fails.The first consumer is the Cloudflare send-to-sentry E2E app in the follow-up PR.
react-send-to-sentryandnode-express-send-to-sentrykeep their fetch-based copies for now and can move over separately.Part of #23610
🤖 Generated with Claude Code