@@ -5,8 +5,7 @@ import act from './act';
55import { addToCleanupQueue } from './cleanup' ;
66import { getConfig } from './config' ;
77import { getHostChildren } from './helpers/component-tree' ;
8- import debugDeep , { DebugOptions } from './helpers/debug-deep' ;
9- import debugShallow from './helpers/debug-shallow' ;
8+ import { debug , DebugOptions } from './helpers/debug' ;
109import { configureHostComponentNamesIfNeeded } from './helpers/host-component-names' ;
1110import { validateStringsRenderedWithinText } from './helpers/string-validation' ;
1211import { renderWithAct } from './render-act' ;
@@ -107,7 +106,7 @@ function buildRenderResult(
107106 unmount,
108107 rerender : update , // alias for `update`
109108 toJSON : renderer . toJSON ,
110- debug : debug ( instance , renderer ) ,
109+ debug : makeDebug ( instance , renderer ) ,
111110 get root ( ) : ReactTestInstance {
112111 return getHostChildren ( instance ) [ 0 ] ;
113112 } ,
@@ -141,12 +140,9 @@ function updateWithAct(
141140 } ;
142141}
143142
144- export interface DebugFunction {
145- ( options ?: DebugOptions | string ) : void ;
146- shallow : ( message ?: string ) => void ;
147- }
143+ export type DebugFunction = ( options ?: DebugOptions | string ) => void ;
148144
149- function debug ( instance : ReactTestInstance , renderer : ReactTestRenderer ) : DebugFunction {
145+ function makeDebug ( instance : ReactTestInstance , renderer : ReactTestRenderer ) : DebugFunction {
150146 function debugImpl ( options ?: DebugOptions | string ) {
151147 const { defaultDebugOptions } = getConfig ( ) ;
152148 const debugOptions =
@@ -157,15 +153,14 @@ function debug(instance: ReactTestInstance, renderer: ReactTestRenderer): DebugF
157153 if ( typeof options === 'string' ) {
158154 // eslint-disable-next-line no-console
159155 console . warn (
160- 'Using debug("message") is deprecated and will be removed in future release, please use debug({ message; "message" }) instead.' ,
156+ 'Using debug("message") is deprecated and will be removed in future release, please use debug({ message: "message" }) instead.' ,
161157 ) ;
162158 }
163159
164160 const json = renderer . toJSON ( ) ;
165161 if ( json ) {
166- return debugDeep ( json , debugOptions ) ;
162+ return debug ( json , debugOptions ) ;
167163 }
168164 }
169- debugImpl . shallow = ( message ?: string ) => debugShallow ( instance , message ) ;
170165 return debugImpl ;
171166}
0 commit comments