-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
feat: createRequire
option and disable esm for jest
#7476
Conversation
459904a
to
dea3986
Compare
Codecov Report
@@ Coverage Diff @@
## dev #7476 +/- ##
==========================================
+ Coverage 70.16% 70.18% +0.02%
==========================================
Files 88 88
Lines 3717 3733 +16
Branches 1008 1015 +7
==========================================
+ Hits 2608 2620 +12
- Misses 901 905 +4
Partials 208 208
Continue to review full report at Codecov.
|
@pi0 Feel free to merge or close if we're gonna remove esm. |
@clarkdo PR is good we should remove esm more carefully. I was just thinking to provide an option instead of disabling using |
createRequire
option and deprecate esm for jest
- we already have this dependency - jest mocks confirmed to working - will help for pnp migration
createRequire
option and deprecate esm for jestcreateRequire
option and disable esm for jest
Types of changes
Description
esm disabled by default
As esm package has been incompatible since jest 25, this PR disables esm for jest environments by default to prevent regression happening when testing nuxt with jest. You may need to make changes to your project after this PR:
jest config:
babel config:
createRequire
optionMeanwhile, we have started working on
jiti
project for stable esm/typescript runtime support. You can try it by settingcreateRequire: 'jiti'
insidenuxt.config
.Also, it is possible to use this option to keep using
esm
with jest < 25 or provide a custom factory function. Setting value to false or unsupported value, makes nuxt using native require (via create-require)Checklist: