Skip to content

regression: console.error supression no longer works in 0.5 #50

Closed
@ntucker

Description

@ntucker
  • react-hooks-testing-library version: 0.5.0
  • react-testing-library version: 6.1.2
  • react version: 16.8.6
  • node version: 11.10
  • npm (or yarn) version: 1.15.2

Relevant code or config:

facebook/react#11098 (comment)

let your = (code, tell) => `the ${story}`;

What you did:

function onError(e: any) {
  e.preventDefault();
}
beforeEach(() => {
  window.addEventListener('error', onError);
});
afterEach(() => {
  window.removeEventListener('error', onError);
});

What happened:

console.error node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9215
The above error occurred in the component:
in TestHook
in Suspense
in ErrorBoundary
in Suspense (created by wrapper)
in ExternalCacheProvider
in Unknown (created by wrapper)
in wrapper

React will try to recreate this component tree from scratch using the error boundary you provided, ErrorBoundary.

Reproduction:

Problem description:

This used to suppress the console errors from things thrown in render being caught by errorboundaries. It doesn't work anymore

Suggested solution:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions