-
-
Notifications
You must be signed in to change notification settings - Fork 533
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
Fix #1098: ignored()
bug: ESM loader will try to compile .cjs, .mjs…
#1103
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1103 +/- ##
==========================================
+ Coverage 75.49% 75.68% +0.18%
==========================================
Files 7 7
Lines 657 658 +1
Branches 148 147 -1
==========================================
+ Hits 496 498 +2
Misses 107 107
+ Partials 54 53 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Looks good; can we add a test for this? We might be able to add to one of our existing ESM test cases. We need to make sure that the test will fail if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a regression test; otherwise looks good.
…ns are sent to TypeScript compiler
I have added a few white-box tests for I did have a question regarding mixed capitalization extensions (e.g. This could be accomplished with a Lines 837 to 846 in de289f6
I also think the ESM loader Lines 73 to 77 in 77f568d
Instead: // If file is not ignored, then ask node how it would treat this file if it were .js
if (!tsNodeInstance.ignored(nativePath)) {
return defer(formatUrl(pathToFileURL(nativePath + '.js')))
} Although, I am not sure if there are any ramifications to this. Let me know what you think. |
Tests look great. Should we add the Agreed about amending the Regarding mixed capitalization extensions: I just tested, and our require hooks don't support mixed capitalization on Linux. Seems like this has been a very long-standing limitation and we haven't received any bug reports about it. I feel confident leaving it out of this pull request. If you want, feel free to file a separate issue to investigate. But I don't think it's a high priority. |
Currently Lines 629 to 637 in 77f568d
I think it is fine as is, this error will be automatically raised if somehow a user manages to get a .d.ts file to be interpreted as a module. Good to go on this front, I think.
I have made the Lines 73 to 77 in afdf964
I am mildly surprised that no issue has ever been raised about mixed capitalized extensions, but it definitely is not a priority or really that important. A nitpick, I suppose. Thanks for looking into it. |
Looks great. I added .d.ts extensions to the tests to avoid any surprises there, and tests are still passing so I'll go ahead and merge this. Thanks again @concision ! |
Fixes #1098