Skip to content

test: cover PostHog instrumentation initialization - #63

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/missing-test-coverage-cf91
Draft

test: cover PostHog instrumentation initialization#63
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/missing-test-coverage-cf91

Conversation

@cursor

@cursor cursor Bot commented Jul 25, 2026

Copy link
Copy Markdown

Summary

Risky behavior now covered

A configuration regression in this entry point can silently stop analytics, send events to the wrong host, create unwanted person profiles, or duplicate pageview events. The tests isolate module imports and environment variables so each guard is deterministic.

Test files added

  • test/instrumentation-client.test.ts

Why this materially reduces regression risk

Existing coverage PRs test production-host gating and component pageview/identity calls, but not the SDK initialization boundary. These tests fail if initialization becomes unconditional, required configuration is ignored, or a behavior-sensitive PostHog option changes. A mutation of capture_pageview from false to true was confirmed to fail the focused test.

Validation

  • npm test — 39/39 passing
  • npm run build
  • npx prettier --check test/instrumentation-client.test.ts
Open in Web View Automation 

Co-authored-by: Parvez Kose <koseparvez@gmail.com>
@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
polyagent Ready Ready Preview, Comment Jul 25, 2026 10:07am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant