Repository navigation
test(react): cover NODE_ENV guard on ErrorBoundaryGroupContext displayName - #1990
Archibald1948 wants to merge 1 commit into
Conversation
…yName ErrorBoundaryGroupContext only gets its displayName when NODE_ENV is 'development'. vitest.setup.ts stubs NODE_ENV to 'development' for every test, so the production branch was never exercised. Re-import the module under each NODE_ENV with vi.resetModules() to cover both branches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
People can be co-author:
|
|
@Archibald1948 is attempting to deploy a commit to the Toss Team on Vercel. A member of the Team first needs to authorize it. |
|
@kangju2000 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1990 +/- ##
=======================================
Coverage 93.22% 93.22%
=======================================
Files 42 42
Lines 664 664
Branches 163 163
=======================================
Hits 619 619
Misses 42 42
Partials 3 3
🚀 New features to boost your workflow:
|
Overview
Related to #1464 (100% coverage). Follow-up to #1987.
ErrorBoundaryGroupContextonly gets adisplayNamewhenNODE_ENVis'development'(packages/react/src/ErrorBoundaryGroup.tsxL22). Sincevitest.setup.tsstubsNODE_ENVto'development'for every test, the production branch was never exercised, which left this file at 90% branch coverage.This PR adds a parameterized test that stubs
NODE_ENV, resets the module registry withvi.resetModules(), and dynamically re-imports./ErrorBoundaryGroupso the module-level guard is evaluated under each environment:development→displayNameis'ErrorBoundaryGroupContext'production→displayNameisundefinedafterEachrestores thedevelopmentstub and resets modules again, following the same pattern used inErrorBoundary.spec.tsx.Result
ErrorBoundaryGroup.tsx: branch coverage 90% → 100%@suspensive/reactpackage branch coverage: 95.71% → 96.42%if (true)makes theproductioncase fail.Test-only change, so no changeset.
PR Checklist
🤖 Generated with Claude Code