@@ -177,18 +177,19 @@ function updateModuleForToNestedModule(j, root) {
177177 return [ moduleInvocation , callback . body . body , setupType ] ;
178178 }
179179
180- function processRenderingTest ( expression ) {
181- let isTest = j . match ( expression , { expression : { callee : { name : 'test' } } } ) ;
180+ function processRenderingTest ( testExpression ) {
181+ let isTest = j . match ( testExpression , { expression : { callee : { name : 'test' } } } ) ;
182182 if ( ! isTest ) {
183183 return ;
184184 }
185185
186186 // mark the test function as an async function
187- expression . expression . arguments [ 1 ] . async = true ;
187+ testExpression . expression . arguments [ 1 ] . async = true ;
188+ let testExpressionCollection = j ( testExpression ) ;
188189
189190 // Transform to await render() or await clearRender()
190191 [ 'render' , 'clearRender' ] . forEach ( type => {
191- findTestHelperUsageOf ( j , j ( expression ) , type ) . forEach ( p => {
192+ findTestHelperUsageOf ( j , testExpressionCollection , type ) . forEach ( p => {
192193 let expression = p . get ( 'expression' ) ;
193194
194195 let awaitExpression = j . awaitExpression (
@@ -197,6 +198,21 @@ function updateModuleForToNestedModule(j, root) {
197198 expression . replace ( awaitExpression ) ;
198199 } ) ;
199200 } ) ;
201+
202+ // Migrate `this._element` -> `this.element`
203+ testExpressionCollection
204+ . find ( j . MemberExpression , {
205+ object : {
206+ type : 'ThisExpression' ,
207+ } ,
208+ property : {
209+ name : '_element' ,
210+ } ,
211+ } )
212+ . forEach ( p => {
213+ let property = p . get ( 'property' ) ;
214+ property . node . name = 'element' ;
215+ } ) ;
200216 }
201217
202218 let programPath = root . get ( 'program' ) ;
0 commit comments