@@ -5,8 +5,7 @@ import act from './act';
5
5
import { addToCleanupQueue } from './cleanup' ;
6
6
import { getConfig } from './config' ;
7
7
import { 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' ;
10
9
import { configureHostComponentNamesIfNeeded } from './helpers/host-component-names' ;
11
10
import { validateStringsRenderedWithinText } from './helpers/string-validation' ;
12
11
import { renderWithAct } from './render-act' ;
@@ -107,7 +106,7 @@ function buildRenderResult(
107
106
unmount,
108
107
rerender : update , // alias for `update`
109
108
toJSON : renderer . toJSON ,
110
- debug : debug ( instance , renderer ) ,
109
+ debug : makeDebug ( instance , renderer ) ,
111
110
get root ( ) : ReactTestInstance {
112
111
return getHostChildren ( instance ) [ 0 ] ;
113
112
} ,
@@ -141,12 +140,9 @@ function updateWithAct(
141
140
} ;
142
141
}
143
142
144
- export interface DebugFunction {
145
- ( options ?: DebugOptions | string ) : void ;
146
- shallow : ( message ?: string ) => void ;
147
- }
143
+ export type DebugFunction = ( options ?: DebugOptions | string ) => void ;
148
144
149
- function debug ( instance : ReactTestInstance , renderer : ReactTestRenderer ) : DebugFunction {
145
+ function makeDebug ( instance : ReactTestInstance , renderer : ReactTestRenderer ) : DebugFunction {
150
146
function debugImpl ( options ?: DebugOptions | string ) {
151
147
const { defaultDebugOptions } = getConfig ( ) ;
152
148
const debugOptions =
@@ -157,15 +153,14 @@ function debug(instance: ReactTestInstance, renderer: ReactTestRenderer): DebugF
157
153
if ( typeof options === 'string' ) {
158
154
// eslint-disable-next-line no-console
159
155
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.' ,
161
157
) ;
162
158
}
163
159
164
160
const json = renderer . toJSON ( ) ;
165
161
if ( json ) {
166
- return debugDeep ( json , debugOptions ) ;
162
+ return debug ( json , debugOptions ) ;
167
163
}
168
164
}
169
- debugImpl . shallow = ( message ?: string ) => debugShallow ( instance , message ) ;
170
165
return debugImpl ;
171
166
}
0 commit comments