Skip to content
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(core): jest plugin should work with nodenext set in tsconfig #28820

Merged
merged 1 commit into from
Nov 6, 2024

Conversation

ndcunningham
Copy link
Contributor

@ndcunningham ndcunningham commented Nov 6, 2024

Current Behavior

When you create a new project using the new ts setup to support ts project references jest does not work out of the box due to incompatibility with the module being set inside tsconfig to nodenext.

Expected Behavior

Jest should work out of the box with our current setup

Related Issue(s)

Fixes #

@ndcunningham ndcunningham self-assigned this Nov 6, 2024
@ndcunningham ndcunningham requested a review from a team as a code owner November 6, 2024 17:15
@ndcunningham ndcunningham requested a review from jaysoo November 6, 2024 17:15
Copy link

vercel bot commented Nov 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Nov 6, 2024 9:10pm

@jaysoo
Copy link
Member

jaysoo commented Nov 6, 2024

LGTM, but we need to remove this warning as well:

 NX   Compiler option 'moduleResolution' in tsconfig.base.json must be 'node' or 'node10'

Jest requires 'moduleResolution' to be set to 'node' or 'node10' to work properly. It would need to be changed in the "tsconfig.base.json" file. It's not enough to override the compiler option in the project's tsconfig file.
Alternatively, you can use the environment variable `TS_NODE_COMPILER_OPTIONS='{"moduleResolution": "node10"}'` to override Jest's usage of ts-node.

@ndcunningham ndcunningham force-pushed the fix/jest-ts-node-resolution branch from e7d7590 to 7c462f5 Compare November 6, 2024 21:07
@ndcunningham ndcunningham changed the title fix(core): projects should work with nodenext set in tsconfig fix(core): jest plugin should work with nodenext set in tsconfig Nov 6, 2024
@ndcunningham ndcunningham merged commit 6afc286 into master Nov 6, 2024
6 checks passed
@ndcunningham ndcunningham deleted the fix/jest-ts-node-resolution branch November 6, 2024 21:46
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants