docs: instructions to solve v10 compatibility issues with jest#3616
docs: instructions to solve v10 compatibility issues with jest#3616pkuczynski wants to merge 1 commit intonextfrom
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.
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 |
|
@pkuczynski are you still interested in providing a solution here? |
No description provided.