@@ -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' ;
@@ -105,7 +104,7 @@ function buildRenderResult(
105104 unmount,
106105 rerender : update , // alias for `update`
107106 toJSON : renderer . toJSON ,
108- debug : debug ( instance , renderer ) ,
107+ debug : makeDebug ( instance , renderer ) ,
109108 get root ( ) : ReactTestInstance {
110109 return getHostChildren ( instance ) [ 0 ] ;
111110 } ,
@@ -139,12 +138,9 @@ function updateWithAct(
139138 } ;
140139}
141140
142- export interface DebugFunction {
143- ( options ?: DebugOptions | string ) : void ;
144- shallow : ( message ?: string ) => void ;
145- }
141+ export type DebugFunction = ( options ?: DebugOptions | string ) => void ;
146142
147- function debug ( instance : ReactTestInstance , renderer : ReactTestRenderer ) : DebugFunction {
143+ function makeDebug ( instance : ReactTestInstance , renderer : ReactTestRenderer ) : DebugFunction {
148144 function debugImpl ( options ?: DebugOptions | string ) {
149145 const { defaultDebugOptions } = getConfig ( ) ;
150146 const debugOptions =
@@ -155,15 +151,14 @@ function debug(instance: ReactTestInstance, renderer: ReactTestRenderer): DebugF
155151 if ( typeof options === 'string' ) {
156152 // eslint-disable-next-line no-console
157153 console . warn (
158- 'Using debug("message") is deprecated and will be removed in future release, please use debug({ message; "message" }) instead.' ,
154+ 'Using debug("message") is deprecated and will be removed in future release, please use debug({ message: "message" }) instead.' ,
159155 ) ;
160156 }
161157
162158 const json = renderer . toJSON ( ) ;
163159 if ( json ) {
164- return debugDeep ( json , debugOptions ) ;
160+ return debug ( json , debugOptions ) ;
165161 }
166162 }
167- debugImpl . shallow = ( message ?: string ) => debugShallow ( instance , message ) ;
168163 return debugImpl ;
169164}
0 commit comments