Chore: Remove console output in ErrorBoundary.test.tsx (#45138)

pull/45139/merge
Hugo Häggmark 3 years ago committed by GitHub
parent 605d056136
commit 0282d5f9c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      packages/grafana-ui/src/components/ErrorBoundary/ErrorBoundary.test.tsx

@ -9,7 +9,18 @@ const ErrorThrower: FC<{ error: Error }> = ({ 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', () => {
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 () => {
const problem = new Error('things went terribly wrong');
render(

Loading…
Cancel
Save