-
-
Notifications
You must be signed in to change notification settings - Fork 1k
docs: instructions to solve v10 compatibility issues with jest #3616
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
base: next
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for fakerjs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #3616 +/- ##
=======================================
Coverage 99.97% 99.97%
=======================================
Files 2894 2894
Lines 222390 222390
Branches 932 929 -3
=======================================
Hits 222337 222337
Misses 53 53 🚀 New features to boost your workflow:
|
```ts | ||
// Transform both `ts` and `js` files. Defining only `ts` would not be enough, as we also need to transform @faker-js | ||
transform: { | ||
'^.+\\.(t|j)s$': 'ts-jest', | ||
|
||
// or when you pass more settings: | ||
'^.+\\.(t|j)s$': [ | ||
'ts-jest', | ||
// ... other setttings | ||
] | ||
} | ||
|
||
// Exclude from transformation all files in `node_modules`, except `@faker-js` | ||
transformIgnorePatterns: [ | ||
// npm | ||
'node_modules/(?!@faker-js).+', | ||
|
||
// pnpm | ||
'node_modules/.pnpm/.+/node_modules/(?!@faker-js).+' | ||
], | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change itself looks fine. I was thinking about representing the code block for the config as a Code Group to better differentiate between npm and pnpm packages.
BUT, this documentation only represents a migration option for ts-jest
. By default Jest uses babel-jest. Also, the transformer configuration itself is not that important - only that you have one defined for *.js
files. That's why I would probably replace the "transform" section in a more generic way, like this:
// Transform both `ts` and `js` files. Defining only `ts` would not be enough, as we also need to transform @faker-js
transform: {
'^.+\\.(t|j)s$': 'ts-jest', // use the transformer and configuration of your choice
}
// Exclude from transformation all files in `node_modules`, except `@faker-js`
transformIgnorePatterns: [
// npm
'node_modules/(?!@faker-js).+',
// pnpm
'node_modules/.pnpm/.+/node_modules/(?!@faker-js).+'
],
Maybe we should try to keep this short and put a longer description and workarounds on https://fakerjs.dev/guide/frameworks.html |
No description provided.