Commit Graph

1 Commits

Author SHA1 Message Date
Divanshu Chauhan (divkix) b49974eb4f fix: add tests verifying strings thrown in Server Components are not swallowed (#950)
* fix: add tests verifying strings thrown in Server Components are not swallowed (#810)

Next.js had a bug where createReactServerErrorHandler returned early
for typeof thrownValue === 'string', swallowing the error before
logging. vinext's rscOnError already handles strings correctly (they
flow through the normal error path and get wrapped into Error objects).

Added:
- Fixture page that throws a string in a Server Component
- Integration test verifying the error boundary renders with the string message
- Runtime test confirming rscOnError returns a valid digest for string throws
- Static test confirming generated code has no early string-return path

Upstream: vercel/next.js@b9ca95c62d

* fix: address review feedback on string error handling tests (#950)

- Move prodRscOnError creation into beforeAll to avoid duplicating new Function construction
- Remove brittle positive assertions (instanceof Error, String(error)) from static test; keep only the negative anti-pattern guard
- Use textContentByTestId helper for integration test precision over loose html.toContain
2026-04-29 21:14:04 +01:00