-
Notifications
You must be signed in to change notification settings - Fork 455
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
[Bug]: Outdated documentation for esm-support #3828
Comments
PR is welcome About However, we can add the regex to the |
I can update the documentation for regex_match_files. However whenever I add |
I think updating documentation is ok. Regarding to the error, it seems like Jest doesn't recognize the ESM config. You can compare your config with example apps https://github.com/kulshekhar/ts-jest/tree/main/examples |
Actually I think the issue is that my repository is ESM and however you're pulling in resets is cjs specific. I created this example repo for you:
If this is a code issue, I think it should be a separate ticket and let's leave this for documentation updates. |
The presets only set the transform regex and transformer name, it doesn’t set anything else https://github.com/kulshekhar/ts-jest/blob/main/src/presets/create-jest-preset.ts And it's more for Jest because |
Maybe the issue is on jest's side and it's not respecting that ts-jest is cjs? In my experience If I had to guess the issue is here: But again, that's just a guess. For now I'll just stop using the preset and copy the contents I need but just calling it out as something that might need to be tracked down. |
You can play with the example app https://github.com/kulshekhar/ts-jest/blob/main/examples/ts-only/jest-esm.config.js because it works there. |
Yes because that project is also still cjs. You need to add |
For the documentation, for Jest@29 is |
That one Jest requires to set always:( |
I found the issue. Indeed it was caused by Jest merged config. The transformer config which is passed into EDITED I think I might find a way to fix it:) |
Thank you @k2snowman69 and @ahnpnl for investigating & fixing - this issue has been preventing us from migrating our ESM-only packages to v29. Would it be possible to cut a new patch-level release with this fix? Thanks! |
Version
29.0.1
Steps to reproduce
Setup
"type": "module",
is set in your package.json"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
add.ts
which adds two numbersadd.test.ts
which usesimport * as Utils from "./add.js";
Manual config
With Jest 29 the following worked for me. These are the updates I made:
Preset config
<regex_match_files>
with\\.tsx?$
I couldn't figure out a work around for this situation without removing the preset completely
Help, I want to get up and running
Did you stumble upon this ticket while looking for an answer? Copy paste the following config and you should be unblocked
Expected behavior
Documentation to be updated so that both configurations to run successfully after copy pasting into a jest.config.js
Actual behavior
Manual config
<regex_match_files>
Preset config
<regex_match_files>
preset
attribute seems to cause failures and oddly isn't actually neededDebug log
N/A - Configuration specific, not runtime
Additional context
No response
Environment
System: OS: macOS 12.6 CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz Binaries: Node: 16.13.2 - /usr/local/bin/node npm: 8.9.0 - /usr/local/bin/npm npmPackages: jest: ^29.0.3 => 29.0.3
The text was updated successfully, but these errors were encountered: