Closed puglyfe closed 1 month ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 92.64%. Comparing base (
a94e2b5
) to head (87677dc
). Report is 56 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Thanks!
Fixes https://github.com/skovhus/jest-codemods/issues/585
Given an expression statement like
someSpy.calls.argsFor(0)[1]
, different parsers assign differenttype
values to theargsFor
arg node.babel
andflow
parse it astype: "Literal"
, where asbabylon
,ts
andtsx
parse it astype: "NumericLiteral"
. When parsed asNumericLiteral
, it results in invalid syntax when used as an array accessor.This change updates the transform to explicitly set it as
type: "Literal"
regardless of the parser used. I also updated the test for this scenario to use multiple parsers. It's maybe a pattern that would be useful elsewhere, but I'll leave that as a separate effort 😅I also added support for
argsFor
args that aretype: "Identifier"
(e.g.argsFor(someVariable)
).