So adding:
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"json",
"jsx",
"node"
]
to my jest configuration did the trick based on this - moduleFileExtensions: confusing documentation · Issue #7563 · facebook/jest · GitHub. I guess jest found app.json
before App.tsx
and then ran the test against that instead. Reordering the moduleFileExtensions
to put .ts
and .tsx
before .json
is why it works now. Hope this helps!