Skip to content

Commit

Permalink
fix: avoided converting jest.mock() to jest.route()
Browse files Browse the repository at this point in the history
  • Loading branch information
wheresrhys committed Sep 16, 2024
1 parent dbb0b43 commit a42817b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/codemods/src/__test__/integration.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// won't rewrite similarly named methods such as jest.mock
6 changes: 5 additions & 1 deletion packages/codemods/src/codemods/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ export function getAllChainedMethodCalls(fetchMockVariableName, root, j) {
})
.map((path) => {
const paths = [path];
while (path.parentPath.value.type !== 'ExpressionStatement') {
while (
!['ArrowFunctionExpression', 'ExpressionStatement'].includes(
path.parentPath.value.type,
)
) {
path = path.parentPath;
if (path.value.type === 'CallExpression') {
paths.push(path);
Expand Down

0 comments on commit a42817b

Please sign in to comment.