ci(jest): Add Sentry SDK instrumentation to snapshot tests#117459
Merged
Conversation
Add the same Sentry test environment config from jest.config.ts to jest.config.snapshots.ts so snapshot test runs report traces to Sentry. Create a node variant of the SafeSentryEnvironment wrapper since snapshot tests use a node environment instead of jsdom. Pass SENTRY_DSN and GitHub context env vars in the frontend-snapshots workflow. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
Remove the duplicate jest-environment-node.js wrapper and point the snapshot config at the package export instead. The structuredClone workaround is only needed for the jsdom environment's in-band mode. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
Move the structuredClone workaround into a shared wrapWithStructuredClone function so the node environment entry point can reuse it without duplicating the logic. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
Move wrapWithStructuredClone into its own file to fix TS2309 (mixed CJS exports) and TS2305 (named export from default-export module). Both jest-environment.js and jest-environment-node.js now import the shared function instead of duplicating or re-exporting it. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
NicoHinderling
approved these changes
Jun 11, 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.
Summary
jest.config.snapshots.ts, mirroring the existing config injest.config.tsso snapshot test runs report traces to Sentry in CISafeSentryEnvironmentwrapper (jest-environment-node.js) since snapshot tests use a node environment instead of jsdomSENTRY_DSN,GITHUB_PR_SHA, andGITHUB_PR_REFenv vars in thefrontend-snapshots.ymlworkflowTest plan
pnpm run snapshotspasses locally (14 suites, 418 tests)