@@ -36,6 +36,31 @@ type ReactTestRendererJSON = {
3636 $$typeof ? : any ,
3737} ;
3838
39+ let injected = false ;
40+ function inject ( ) {
41+ if ( injected ) {
42+ return ;
43+ }
44+
45+ injected = true ;
46+
47+ ReactUpdates . injection . injectReconcileTransaction (
48+ ReactTestReconcileTransaction ,
49+ ) ;
50+ ReactUpdates . injection . injectBatchingStrategy ( ReactDefaultBatchingStrategy ) ;
51+
52+ ReactHostComponent . injection . injectGenericComponentClass ( ReactTestComponent ) ;
53+ ReactHostComponent . injection . injectTextComponentClass ( ReactTestTextComponent ) ;
54+ ReactEmptyComponent . injection . injectEmptyComponentFactory ( function ( ) {
55+ return new ReactTestEmptyComponent ( ) ;
56+ } ) ;
57+
58+ ReactComponentEnvironment . injection . injectEnvironment ( {
59+ processChildrenUpdates : function ( ) { } ,
60+ replaceNodeWithMarkup : function ( ) { } ,
61+ } ) ;
62+ }
63+
3964/**
4065 * Drill down (through composites and empty components) until we get a native or
4166 * native text component.
@@ -134,24 +159,12 @@ Object.assign(ReactTestComponent.prototype, ReactMultiChild);
134159
135160// =============================================================================
136161
137- ReactUpdates . injection . injectReconcileTransaction (
138- ReactTestReconcileTransaction ,
139- ) ;
140- ReactUpdates . injection . injectBatchingStrategy ( ReactDefaultBatchingStrategy ) ;
141-
142- ReactHostComponent . injection . injectGenericComponentClass ( ReactTestComponent ) ;
143- ReactHostComponent . injection . injectTextComponentClass ( ReactTestTextComponent ) ;
144- ReactEmptyComponent . injection . injectEmptyComponentFactory ( function ( ) {
145- return new ReactTestEmptyComponent ( ) ;
146- } ) ;
147-
148- ReactComponentEnvironment . injection . injectEnvironment ( {
149- processChildrenUpdates : function ( ) { } ,
150- replaceNodeWithMarkup : function ( ) { } ,
151- } ) ;
152-
153162var ReactTestRenderer = {
154- create : ReactTestMount . render ,
163+ create : ( ) => {
164+ inject ( ) ;
165+
166+ return ReactTestMount . render ( ) ;
167+ } ,
155168 /* eslint-disable camelcase */
156169 unstable_batchedUpdates : ReactUpdates . batchedUpdates ,
157170 /* eslint-enable camelcase */
0 commit comments