-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting TypeError: foo_1.default is not a function #1873
Comments
can you please try the latest version of |
@ahnpnl I have; I've updated ts-jest, jest, and typescript with no change. |
hmm this will be hard to check without any repos. Would you please try making a small repo for this issue ? |
normally the combination of |
@ahnpnl I found the issue. In attempting to simplify to a small repo that would reproduce this, I found a circular reference.
This works with Eliminating the circular reference (by moving one export to another module) resolved the issue. Thank you. |
nice, I'm glad to hear that. So this issue can be also closed ? |
@ahnpnl Yes, it can be closed (unless circular references are a thing you want to support). Thanks again. |
Can you explain how you found this out? What did your code look like. I am not sure of the changes I need to make on mine. |
Solved this error by searching and fixing circular dependencies using Madge: |
Found this on Google. I had this problem, but mine was probably an edge case: I had two files |
🐛 Bug Report
While refactoring a node project, I moved some files around (still in subfolders of src, adjusting the imports).
After doing so, I get an error when running tests of
(foo is my function, renamed for simplicity)
To Reproduce
jest.config.js:
tsconfig.json:
The error occurs in module1.ts:
Foo is defined in foo.ts:
The test in question is in foo.spec.ts (all in the same directory):
tsc
works."allowSyntheticDefaultImports": true
"esModuleInterop": true
moduleNameMapper
(tsconfig-paths-jest and other permutations)Expected behavior
The test works.
Link to repo (highly encouraged)
(Private/proprietary; can't)
Debug log:
(Can't include - references proprietary info)
envinfo
The text was updated successfully, but these errors were encountered: