tests(core): Move anthropic node integration tests to use a real client#21906
Open
nicohrubec wants to merge 1 commit into
Open
tests(core): Move anthropic node integration tests to use a real client#21906nicohrubec wants to merge 1 commit into
nicohrubec wants to merge 1 commit into
Conversation
Replaces the hand-written MockAnthropic classes across the anthropic node-integration-test scenarios (streaming, tools, errors, and truncation) with the real @anthropic-ai/sdk driven by express mock servers, matching the rest of the suite. Removes the redundant manual-client scenario — the auto integration already wraps clients via the same instrumentAnthropicAiClient it would exercise. No SDK/instrumentation behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
5b08c83 to
3b1d083
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3b1d083. Configure here.
nicohrubec
commented
Jul 1, 2026
| @@ -1,115 +0,0 @@ | |||
| import { instrumentAnthropicAiClient } from '@sentry/core'; | |||
Member
Author
There was a problem hiding this comment.
this one should be redundant, since the auto-instrumentation basically just calls the manual instrumentation helper internally so no need to have a separate scenario for that
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.

While working on the orchestrion port for the anthropic instrumentation I noticed that all of the anthropic tests use fake clients instead of the pattern openai uses with a real client and a mocked server. Since the client is what we instrument it should be much more useful to use the real one in our tests and also allows to reuse all the scenarios here for the orchestrion port, since orchestrion instruments the real library source so that doesn't work with a fake.
This PR ports all the tests to a real client. Porting this over also uncovered a minor bug where the stop reason is not being recorded correctly during streaming (will fix in a follow up).