diff --git a/packages/react/src/errorboundary.tsx b/packages/react/src/errorboundary.tsx index a4920cb37b2b..178737a45cf4 100644 --- a/packages/react/src/errorboundary.tsx +++ b/packages/react/src/errorboundary.tsx @@ -147,7 +147,9 @@ class ErrorBoundary extends React.Component { captureContext: { contexts: { react: { componentStack: expect.any(String) } }, }, - mechanism: { handled: false }, + mechanism: { handled: true }, }); expect(mockOnError.mock.calls[0][0]).toEqual(mockCaptureException.mock.calls[0][0]); @@ -300,7 +300,7 @@ describe('ErrorBoundary', () => { captureContext: { contexts: { react: { componentStack: expect.any(String) } }, }, - mechanism: { handled: false }, + mechanism: { handled: true }, }); // Check if error.cause -> react component stack @@ -339,7 +339,7 @@ describe('ErrorBoundary', () => { captureContext: { contexts: { react: { componentStack: expect.any(String) } }, }, - mechanism: { handled: false }, + mechanism: { handled: true }, }); expect(mockOnError.mock.calls[0][0]).toEqual(mockCaptureException.mock.calls[0][0]); @@ -383,7 +383,7 @@ describe('ErrorBoundary', () => { captureContext: { contexts: { react: { componentStack: expect.any(String) } }, }, - mechanism: { handled: false }, + mechanism: { handled: true }, }); expect(mockOnError.mock.calls[0][0]).toEqual(mockCaptureException.mock.calls[0][0]); @@ -515,6 +515,48 @@ describe('ErrorBoundary', () => { expect(mockOnReset).toHaveBeenCalledTimes(1); expect(mockOnReset).toHaveBeenCalledWith(expect.any(Error), expect.any(String), expect.any(String)); }); + + it('sets `handled: true` when a fallback is provided', async () => { + render( +