-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
withNx function changes broke next/jest
(native NextJS feature)
#16277
Comments
next/jest
next/jest
(native NextJS feature)
We are still experiencing the problem in version 16.1. Would it be possible to obtain an estimate for when this issue can be addressed? As it stands, this issue is preventing us from updating our dependencies and addressing other issues with the nxcloud. |
We ran into this as well. The issue seems to be that when passing in export default async function hack() {
const prevNxTarget = process.env.NX_TASK_TARGET_TARGET;
// temporarily override NX_TASK_TARGET_TARGET to be "build" so that withNx() returns the next config
process.env.NX_TASK_TARGET_TARGET = 'build';
const jestConfig = await createJestConfig(customJestConfig)();
process.env.NX_TASK_TARGET_TARGET = prevNxTarget;
return jestConfig;
} and that fixes the issue for us. Aside from loading Another, less hacky solution that worked for us was to omit passing resolver: '@nx/jest/plugins/resolver' which @barbados-clemens made reference to in #15315 (comment). This resolver has some fallback logic in it for resolving modules via As a final disclaimer, we're just getting starting with Nx as well as our Next.js application so I'm not sure if/how well either of these solutions work with larger, more complex Next.js applications. |
This has been fixed in the merged PR. It will be in the new release (either this week or next week). |
We're still experiencing the same problem, but we're using
As soon as I remove |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current Behavior
If you include
next/jest
[ref] in an application that uses withNx, an error will occur when running the unit tests.Without using withNx, the error won't occur. However, if you add [0] to the withNx function, it will work again.
Expected Behavior
The exported next configuration should work with any tool native of the NextJS, like the
next/jest
.GitHub Repo
https://github.com/raphzandrade/next-errors
Steps to Reproduce
jest.config.ts
file (the dir value must points to a valid application).Nx Report
Failure Logs
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: