Testing next/jest in a monorepo using yarn
Unanswered
Northeast Congo Lion posted this in #help-forum
Northeast Congo LionOP
TLDR: How do I install a specific commit of
Hi gang, I'm having an issue with the jest swc transpiling modules that it shouldn't be to local paths
Specifically, it's resolving imports of the old
Determined this by getting a debugger into the jest tests being run, and saw the
I've pinned this issue to
Trying to do a bisect on the commits between these two versions to get a better idea of what the issue actually is, so need to be able to install a local version of next
Have read through the document on developing using a local version
https://github.com/vercel/next.js/blob/canary/contributing/core/developing-using-local-app.md
However, the monorepo this is going into uses
Trying to install
Results in not being able to resolve this:
Installing as a link, like:
Results in not being able to resolve the base
Is there a way to install a particular commit of
If not, is there anything here that I'm missing to get the install to work as expected?
If not, are modules transpiling when they shouldn't be a known issue?
If not, is there a way to specifically exclude modules from transpilation?
Cheers for any help here 🙂 rambly question
next?Hi gang, I'm having an issue with the jest swc transpiling modules that it shouldn't be to local paths
Specifically, it's resolving imports of the old
prop-types library to a folder in a monorepo app under src/prop-types, breaking all of the jest tests in that app.Determined this by getting a debugger into the jest tests being run, and saw the
prop-types import was resolving to ..I've pinned this issue to
next@14.1.1-canary.37, canary 36 does not reproTrying to do a bisect on the commits between these two versions to get a better idea of what the issue actually is, so need to be able to install a local version of next
Have read through the document on developing using a local version
https://github.com/vercel/next.js/blob/canary/contributing/core/developing-using-local-app.md
However, the monorepo this is going into uses
yarn workspaces, not pnpmTrying to install
next directly from its path like:yarn add ~/.../next.js/packages/nextResults in not being able to resolve this:
Error: Cannot find module './dist/build/jest/jest'
Require stack:
- /Users/kranners/.../monorepo/node_modules/next/jest.js
- /Users/kranners/.../monorepo/apps/the-app-in-question/jest.config.jsInstalling as a link, like:
yarn add link:../path/to/next.js/packages/nextResults in not being able to resolve the base
next/jest:Error: Cannot find module 'next/jest'
Require stack:
- /Users/kranners/.../monorepo/apps/the-app-in-question/jest.config.js
- /Users/kranners/.../monorepo/node_modules/jest-util/build/requireOrImportModule.jsIs there a way to install a particular commit of
next without building locally?If not, is there anything here that I'm missing to get the install to work as expected?
If not, are modules transpiling when they shouldn't be a known issue?
If not, is there a way to specifically exclude modules from transpilation?
Cheers for any help here 🙂 rambly question