@@ -113,16 +113,15 @@ export const getQueriesForElement = (
113113 throw error ;
114114 } ;
115115
116- const result : JSHandle <
117- Element | Element [ ] | DTLError | null
118- > = await page
119- . evaluateHandle (
120- // Using new Function to avoid babel transpiling the import
121- // @ts -expect-error pptr's types don't like new Function
122- new Function (
123- 'argsString' ,
124- 'element' ,
125- `return import("http://localhost:${ port } /@test-mule/dom-testing-library")
116+ const result : JSHandle < Element | Element [ ] | DTLError | null > =
117+ await page
118+ . evaluateHandle (
119+ // Using new Function to avoid babel transpiling the import
120+ // @ts -expect-error pptr's types don't like new Function
121+ new Function (
122+ 'argsString' ,
123+ 'element' ,
124+ `return import("http://localhost:${ port } /@test-mule/dom-testing-library")
126125 .then(async ({ reviveElementsInString, printElement, addToElementCache, ...dtl }) => {
127126 const deserializedArgs = JSON.parse(argsString, (key, value) => {
128127 if (value.__serialized === 'RegExp')
@@ -148,14 +147,14 @@ export const getQueriesForElement = (
148147 return { failed: true, messageWithElementsRevived, messageWithElementsStringified }
149148 }
150149 })` ,
151- ) ,
152- serializedArgs ,
153- element ?. asElement ( ) ||
154- ( await page
155- . evaluateHandle ( ( ) => document )
156- . catch ( handleExecutionAfterTestFinished ) ) ,
157- )
158- . catch ( handleExecutionAfterTestFinished ) ;
150+ ) ,
151+ serializedArgs ,
152+ element ?. asElement ( ) ||
153+ ( await page
154+ . evaluateHandle ( ( ) => document )
155+ . catch ( handleExecutionAfterTestFinished ) ) ,
156+ )
157+ . catch ( handleExecutionAfterTestFinished ) ;
159158
160159 const failed = await result . evaluate (
161160 ( r ) => typeof r === 'object' && r !== null && ( r as DTLError ) . failed ,
@@ -164,7 +163,8 @@ export const getQueriesForElement = (
164163 const resultProperties = Object . fromEntries (
165164 await result . getProperties ( ) ,
166165 ) ;
167- const messageWithElementsStringified = ( await resultProperties . messageWithElementsStringified . jsonValue ( ) ) as any ;
166+ const messageWithElementsStringified =
167+ ( await resultProperties . messageWithElementsStringified . jsonValue ( ) ) as any ;
168168 const messageWithElementsRevived = await jsHandleToArray (
169169 resultProperties . messageWithElementsRevived ,
170170 ) ;
@@ -186,7 +186,7 @@ export const getQueriesForElement = (
186186 } ) ;
187187 const props = await result . getProperties ( ) ;
188188 for ( const [ key , value ] of props . entries ( ) ) {
189- array [ ( key as any ) as number ] = value ;
189+ array [ key as any as number ] = value ;
190190 }
191191
192192 return array ;
0 commit comments