@@ -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' ;
@@ -105,7 +104,7 @@ function buildRenderResult(
105
104
unmount,
106
105
rerender : update , // alias for `update`
107
106
toJSON : renderer . toJSON ,
108
- debug : debug ( instance , renderer ) ,
107
+ debug : makeDebug ( instance , renderer ) ,
109
108
get root ( ) : ReactTestInstance {
110
109
return getHostChildren ( instance ) [ 0 ] ;
111
110
} ,
@@ -139,12 +138,9 @@ function updateWithAct(
139
138
} ;
140
139
}
141
140
142
- export interface DebugFunction {
143
- ( options ?: DebugOptions | string ) : void ;
144
- shallow : ( message ?: string ) => void ;
145
- }
141
+ export type DebugFunction = ( options ?: DebugOptions | string ) => void ;
146
142
147
- function debug ( instance : ReactTestInstance , renderer : ReactTestRenderer ) : DebugFunction {
143
+ function makeDebug ( instance : ReactTestInstance , renderer : ReactTestRenderer ) : DebugFunction {
148
144
function debugImpl ( options ?: DebugOptions | string ) {
149
145
const { defaultDebugOptions } = getConfig ( ) ;
150
146
const debugOptions =
@@ -155,15 +151,14 @@ function debug(instance: ReactTestInstance, renderer: ReactTestRenderer): DebugF
155
151
if ( typeof options === 'string' ) {
156
152
// eslint-disable-next-line no-console
157
153
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.' ,
159
155
) ;
160
156
}
161
157
162
158
const json = renderer . toJSON ( ) ;
163
159
if ( json ) {
164
- return debugDeep ( json , debugOptions ) ;
160
+ return debug ( json , debugOptions ) ;
165
161
}
166
162
}
167
- debugImpl . shallow = ( message ?: string ) => debugShallow ( instance , message ) ;
168
163
return debugImpl ;
169
164
}
0 commit comments