@@ -181,6 +181,11 @@ const resolvePossibleAliasedGlobal = (
181181 return null ;
182182} ;
183183
184+ const parseJestFnCallCache = new WeakMap <
185+ TSESTree . CallExpression ,
186+ ParsedJestFnCall | string | null
187+ > ( ) ;
188+
184189export const parseJestFnCall = (
185190 node : TSESTree . CallExpression ,
186191 context : TSESLint . RuleContext < string , unknown [ ] > ,
@@ -197,6 +202,23 @@ export const parseJestFnCall = (
197202export const parseJestFnCallWithReason = (
198203 node : TSESTree . CallExpression ,
199204 context : TSESLint . RuleContext < string , unknown [ ] > ,
205+ ) : ParsedJestFnCall | string | null => {
206+ let parsedJestFnCall = parseJestFnCallCache . get ( node ) ;
207+
208+ if ( parsedJestFnCall ) {
209+ return parsedJestFnCall ;
210+ }
211+
212+ parsedJestFnCall = parseJestFnCallWithReasonInner ( node , context ) ;
213+
214+ parseJestFnCallCache . set ( node , parsedJestFnCall ) ;
215+
216+ return parsedJestFnCall ;
217+ } ;
218+
219+ const parseJestFnCallWithReasonInner = (
220+ node : TSESTree . CallExpression ,
221+ context : TSESLint . RuleContext < string , unknown [ ] > ,
200222) : ParsedJestFnCall | string | null => {
201223 const chain = getNodeChain ( node ) ;
202224
0 commit comments