mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Remove console output in ErrorBoundary.test.tsx (#45138)
This commit is contained in:
parent
605d056136
commit
0282d5f9c3
@ -9,7 +9,18 @@ const ErrorThrower: FC<{ error: Error }> = ({ error }) => {
|
|||||||
throw error;
|
throw error;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// According to this issue https://github.com/facebook/react/issues/15069 componentDidCatch logs errors to console.error unconditionally.
|
||||||
|
// Let's make sure we don't output that to console.error in the tests.
|
||||||
|
let consoleSpy: jest.SpyInstance;
|
||||||
describe('ErrorBoundary', () => {
|
describe('ErrorBoundary', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
consoleSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
consoleSpy.mockRestore();
|
||||||
|
});
|
||||||
|
|
||||||
it('should catch error and report it to sentry, including react component stack in context', async () => {
|
it('should catch error and report it to sentry, including react component stack in context', async () => {
|
||||||
const problem = new Error('things went terribly wrong');
|
const problem = new Error('things went terribly wrong');
|
||||||
render(
|
render(
|
||||||
|
Loading…
Reference in New Issue
Block a user