@@ -4,11 +4,11 @@ import filterConsole from 'filter-console'
4
4
5
5
import { addCleanup } from '../core'
6
6
7
- import { RendererProps , WrapperComponent } from '../types/react'
7
+ import { RendererProps , RendererOptions } from '../types/react'
8
8
9
- function suppressErrorOutput ( ) {
9
+ function filterErrorOutput ( ) {
10
10
// The error output from error boundaries is notoriously difficult to suppress. To save
11
- // out users from having to work it out, we crudely suppress the output matching the patterns
11
+ // our users from having to work it out, we crudely suppress the output matching the patterns
12
12
// below. For more information, see these issues:
13
13
// - https://github.com/testing-library/react-hooks-testing-library/issues/50
14
14
// - https://github.com/facebook/react/issues/11098#issuecomment-412682721
@@ -28,7 +28,7 @@ function suppressErrorOutput() {
28
28
29
29
function createTestHarness < TProps , TResult > (
30
30
{ callback, setValue, setError } : RendererProps < TProps , TResult > ,
31
- Wrapper ?: WrapperComponent < TProps > ,
31
+ { wrapper : Wrapper , suppressErrorOutput = true } : RendererOptions < TProps > ,
32
32
suspense : boolean = true
33
33
) {
34
34
const TestComponent = ( { hookProps } : { hookProps ?: TProps } ) => {
@@ -47,7 +47,9 @@ function createTestHarness<TProps, TResult>(
47
47
return null
48
48
}
49
49
50
- suppressErrorOutput ( )
50
+ if ( suppressErrorOutput ) {
51
+ filterErrorOutput ( )
52
+ }
51
53
52
54
const testHarness = ( props ?: TProps ) => {
53
55
resetErrorBoundary ( )
0 commit comments