Skip to content

fix(core): jest plugin should work with nodenext set in tsconfig#28820

Merged
ndcunningham merged 1 commit intomasterfrom
fix/jest-ts-node-resolution
Nov 6, 2024
Merged

fix(core): jest plugin should work with nodenext set in tsconfig#28820
ndcunningham merged 1 commit intomasterfrom
fix/jest-ts-node-resolution

Conversation

@ndcunningham
Copy link
Copy Markdown
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
@vercel
Copy link
Copy Markdown

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

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Nov 6, 2024

@jaysoo
Copy link
Copy Markdown
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
@ndcunningham ndcunningham deleted the fix/jest-ts-node-resolution branch November 6, 2024 21:46
@github-actions
Copy link
Copy Markdown
Contributor

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