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: Resolve config modules with ESM createRequire() #1082
Conversation
Thanks for noticing! The tests don't seem to pass, unfortunately. |
@evocateur can you move I've been meaning to rewrite the tests in ESM as well but it's a huge pain with all the mocking we have. |
@iiroj Ah, dang, that makes sense. Thought I could get away with not running the tests locally. 😢 I'll fix it momentarily. |
ES modules do not have require() available, we must construct it first. This fixes the CLI when passing `--config my-config-package`, broken in v12.0.0. The tests didn't catch this because Jest still doesn't support mocking ESM, and there's really no way to write a test for this right now. I wasn't able to get the automatic `test/__mocks__/resolveConfig.js` to work, probably a race condition between the module parser and the mocker.
a71dbdf
to
74b39f5
Compare
@iiroj I feel your pain with the Jest ESM mocking story. I wasn't able to get the automatic Thanks for your responsiveness! |
Codecov Report
@@ Coverage Diff @@
## master #1082 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 21 21
Lines 593 589 -4
Branches 159 159
=========================================
- Hits 593 589 -4
Continue to review full report at Codecov.
|
🎉 This PR is included in version 12.1.7 🎉 The release is available on: Your semantic-release bot 📦🚀 |
ES modules do not have require() available, we must construct it first.
This fixes the CLI when passing
--config my-config-package
, broken in v12.0.0.The tests didn't catch this because Jest still doesn't support mocking ESM, and there's really no way to write a test for this right now. I verified it locally like this:
Broken
Fixed