Skip to content

ci(jest): Add Sentry SDK instrumentation to snapshot tests#117459

Merged
ryan953 merged 4 commits into
masterfrom
worktree-jest-snapshots-sentry-config
Jun 11, 2026
Merged

ci(jest): Add Sentry SDK instrumentation to snapshot tests#117459
ryan953 merged 4 commits into
masterfrom
worktree-jest-snapshots-sentry-config

Conversation

@ryan953

@ryan953 ryan953 commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary

  • Add Sentry SDK test environment config to jest.config.snapshots.ts, mirroring the existing config in jest.config.ts so snapshot test runs report traces to Sentry in CI
  • Create a node variant of the SafeSentryEnvironment wrapper (jest-environment-node.js) since snapshot tests use a node environment instead of jsdom
  • Pass SENTRY_DSN, GITHUB_PR_SHA, and GITHUB_PR_REF env vars in the frontend-snapshots.yml workflow
  • Add the new file to the eslint config's node globals override

Test plan

  • pnpm run snapshots passes locally (14 suites, 418 tests)
  • Verify traces appear in the Sentry jest project after merging

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>
@ryan953 ryan953 requested review from a team as code owners June 11, 2026 20:03
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 11, 2026
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>
Comment thread jest.config.snapshots.ts Outdated
ryan953 and others added 2 commits June 11, 2026 13:09
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>
@ryan953 ryan953 merged commit 7b078f7 into master Jun 11, 2026
77 checks passed
@ryan953 ryan953 deleted the worktree-jest-snapshots-sentry-config branch June 11, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants