-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: update Configuration.md about pnpm scenarios (#13682)
Co-authored-by: zj21 <[email protected]>
- Loading branch information
Showing
9 changed files
with
71 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2203,13 +2203,17 @@ export default config; | |
|
||
:::tip | ||
|
||
If you use `pnpm` and need to convert some packages under `node_modules`, you need to note that the packages in this folder (e.g. `node_modules/package-a/`) have been symlinked to the path under `.pnpm` (e.g. `node_modules/.pnpm/[email protected]/node_modules/package-a/`), so using `<rootDir>/node_modules/(?!(package-a|package-b)/)` directly will not be recognized, while is to use: | ||
If you use `pnpm` and need to convert some packages under `node_modules`, you need to note that the packages in this folder (e.g. `node_modules/package-a/`) have been symlinked to the path under `.pnpm` (e.g. `node_modules/.pnpm/[email protected]/node_modules/package-a/`), so using `<rootDir>/node_modules/(?!(package-a|@scope/pkg-b)/)` directly will not be recognized, while is to use: | ||
|
||
```js tab | ||
/** @type {import('jest').Config} */ | ||
const config = { | ||
transformIgnorePatterns: [ | ||
'<rootDir>/node_modules/.pnpm/(?!(package-a|package-b)@)', | ||
'<rootDir>/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)', | ||
/* if config file is under '~/packages/lib-a/' */ | ||
`${path.join(__dirname, '../..')}/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)`, | ||
/* or using relative pattern to match the second 'node_modules/' in 'node_modules/.pnpm/@[email protected]/node_modules/@scope/pkg-b/' */ | ||
'node_modules/(?!.pnpm|package-a|@scope/pkg-b)', | ||
], | ||
}; | ||
|
||
|
@@ -2221,7 +2225,11 @@ import type {Config} from 'jest'; | |
|
||
const config: Config = { | ||
transformIgnorePatterns: [ | ||
'<rootDir>/node_modules/.pnpm/(?!(package-a|package-b)@)', | ||
'<rootDir>/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)', | ||
/* if config file is under '~/packages/lib-a/' */ | ||
`${path.join(__dirname, '../..')}/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)`, | ||
/* or using relative path to match the second 'node_modules/' in 'node_modules/.pnpm/@[email protected]/node_modules/@scope/pkg-b/' */ | ||
'node_modules/(?!.pnpm|package-a|@scope/pkg-b)', | ||
], | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1352,18 +1352,20 @@ Example: | |
|
||
:::tip | ||
|
||
If you use `pnpm` and need to convert some packages under `node_modules`, you need to note that the packages in this folder (e.g. `node_modules/package-a/`) have been symlinked to the path under `.pnpm` (e.g. `node_modules/.pnpm/[email protected]/node_modules/package-a/`), so using `<rootDir>/node_modules/(?!(package-a|package-b)/)` directly will not be recognized, while is to use: | ||
If you use `pnpm` and need to convert some packages under `node_modules`, you need to note that the packages in this folder (e.g. `node_modules/package-a/`) have been symlinked to the path under `.pnpm` (e.g. `node_modules/.pnpm/[email protected]/node_modules/package-a/`), so using `<rootDir>/node_modules/(?!(package-a|@scope/pkg-b)/)` directly will not be recognized, while is to use: | ||
|
||
```json | ||
{ | ||
"transformIgnorePatterns": [ | ||
"<rootDir>/node_modules/.pnpm/(?!(package-a|package-b)@)" | ||
"<rootDir>/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)" | ||
] | ||
} | ||
``` | ||
|
||
It should be noted that the folder name of pnpm under `.pnpm` is the package name plus `@` and version number, so writing `/` will not be recognized, but using `@` can. | ||
|
||
Also note that you need using '\`${path.join(__dirname, '../..')}/node_modules/.pnpm/...\`' instead of `<rootDir>/node_modules/.pnpm/...` when the config file is under `~/packages/lib-a/`, or using relative pattern `node_modules/(?!.pnpm|package-a|@scope/pkg-b)` to match the second 'node_modules/' in 'node_modules/.pnpm/@scope+pkg-b@xxx/node_modules/@scope/pkg-b/' | ||
|
||
::: | ||
|
||
### `unmockedModulePathPatterns` \[array<string>] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1348,18 +1348,20 @@ Example: | |
|
||
:::tip | ||
|
||
If you use `pnpm` and need to convert some packages under `node_modules`, you need to note that the packages in this folder (e.g. `node_modules/package-a/`) have been symlinked to the path under `.pnpm` (e.g. `node_modules/.pnpm/[email protected]/node_modules/package-a/`), so using `<rootDir>/node_modules/(?!(package-a|package-b)/)` directly will not be recognized, while is to use: | ||
If you use `pnpm` and need to convert some packages under `node_modules`, you need to note that the packages in this folder (e.g. `node_modules/package-a/`) have been symlinked to the path under `.pnpm` (e.g. `node_modules/.pnpm/[email protected]/node_modules/package-a/`), so using `<rootDir>/node_modules/(?!(package-a|@scope/pkg-b)/)` directly will not be recognized, while is to use: | ||
|
||
```json | ||
{ | ||
"transformIgnorePatterns": [ | ||
"<rootDir>/node_modules/.pnpm/(?!(package-a|package-b)@)" | ||
"<rootDir>/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)" | ||
] | ||
} | ||
``` | ||
|
||
It should be noted that the folder name of pnpm under `.pnpm` is the package name plus `@` and version number, so writing `/` will not be recognized, but using `@` can. | ||
|
||
Also note that you need using '\`${path.join(__dirname, '../..')}/node_modules/.pnpm/...\`' instead of `<rootDir>/node_modules/.pnpm/...` when the config file is under `~/packages/lib-a/`, or using relative pattern `node_modules/(?!.pnpm|package-a|@scope/pkg-b)` to match the second 'node_modules/' in 'node_modules/.pnpm/@scope+pkg-b@xxx/node_modules/@scope/pkg-b/' | ||
|
||
::: | ||
|
||
### `unmockedModulePathPatterns` \[array<string>] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1417,18 +1417,20 @@ Example: | |
|
||
:::tip | ||
|
||
If you use `pnpm` and need to convert some packages under `node_modules`, you need to note that the packages in this folder (e.g. `node_modules/package-a/`) have been symlinked to the path under `.pnpm` (e.g. `node_modules/.pnpm/[email protected]/node_modules/package-a/`), so using `<rootDir>/node_modules/(?!(package-a|package-b)/)` directly will not be recognized, while is to use: | ||
If you use `pnpm` and need to convert some packages under `node_modules`, you need to note that the packages in this folder (e.g. `node_modules/package-a/`) have been symlinked to the path under `.pnpm` (e.g. `node_modules/.pnpm/[email protected]/node_modules/package-a/`), so using `<rootDir>/node_modules/(?!(package-a|@scope/pkg-b)/)` directly will not be recognized, while is to use: | ||
|
||
```json | ||
{ | ||
"transformIgnorePatterns": [ | ||
"<rootDir>/node_modules/.pnpm/(?!(package-a|package-b)@)" | ||
"<rootDir>/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)" | ||
] | ||
} | ||
``` | ||
|
||
It should be noted that the folder name of pnpm under `.pnpm` is the package name plus `@` and version number, so writing `/` will not be recognized, but using `@` can. | ||
|
||
Also note that you need using '\`${path.join(__dirname, '../..')}/node_modules/.pnpm/...\`' instead of `<rootDir>/node_modules/.pnpm/...` when the config file is under `~/packages/lib-a/`, or using relative pattern `node_modules/(?!.pnpm|package-a|@scope/pkg-b)` to match the second 'node_modules/' in 'node_modules/.pnpm/@scope+pkg-b@xxx/node_modules/@scope/pkg-b/' | ||
|
||
::: | ||
|
||
### `unmockedModulePathPatterns` \[array<string>] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1663,18 +1663,20 @@ Example: | |
|
||
:::tip | ||
|
||
If you use `pnpm` and need to convert some packages under `node_modules`, you need to note that the packages in this folder (e.g. `node_modules/package-a/`) have been symlinked to the path under `.pnpm` (e.g. `node_modules/.pnpm/[email protected]/node_modules/package-a/`), so using `<rootDir>/node_modules/(?!(package-a|package-b)/)` directly will not be recognized, while is to use: | ||
If you use `pnpm` and need to convert some packages under `node_modules`, you need to note that the packages in this folder (e.g. `node_modules/package-a/`) have been symlinked to the path under `.pnpm` (e.g. `node_modules/.pnpm/[email protected]/node_modules/package-a/`), so using `<rootDir>/node_modules/(?!(package-a|@scope/pkg-b)/)` directly will not be recognized, while is to use: | ||
|
||
```json | ||
{ | ||
"transformIgnorePatterns": [ | ||
"<rootDir>/node_modules/.pnpm/(?!(package-a|package-b)@)" | ||
"<rootDir>/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)" | ||
] | ||
} | ||
``` | ||
|
||
It should be noted that the folder name of pnpm under `.pnpm` is the package name plus `@` and version number, so writing `/` will not be recognized, but using `@` can. | ||
|
||
Also note that you need using '\`${path.join(__dirname, '../..')}/node_modules/.pnpm/...\`' instead of `<rootDir>/node_modules/.pnpm/...` when the config file is under `~/packages/lib-a/`, or using relative pattern `node_modules/(?!.pnpm|package-a|@scope/pkg-b)` to match the second 'node_modules/' in "node_modules/.pnpm/@scope+pkg-b@xxx/node_modules/@scope/pkg-b/" | ||
|
||
::: | ||
|
||
### `unmockedModulePathPatterns` \[array<string>] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2189,13 +2189,17 @@ export default config; | |
|
||
:::tip | ||
|
||
If you use `pnpm` and need to convert some packages under `node_modules`, you need to note that the packages in this folder (e.g. `node_modules/package-a/`) have been symlinked to the path under `.pnpm` (e.g. `node_modules/.pnpm/[email protected]/node_modules/package-a/`), so using `<rootDir>/node_modules/(?!(package-a|package-b)/)` directly will not be recognized, while is to use: | ||
If you use `pnpm` and need to convert some packages under `node_modules`, you need to note that the packages in this folder (e.g. `node_modules/package-a/`) have been symlinked to the path under `.pnpm` (e.g. `node_modules/.pnpm/[email protected]/node_modules/package-a/`), so using `<rootDir>/node_modules/(?!(package-a|@scope/pkg-b)/)` directly will not be recognized, while is to use: | ||
|
||
```js tab | ||
/** @type {import('jest').Config} */ | ||
const config = { | ||
transformIgnorePatterns: [ | ||
'<rootDir>/node_modules/.pnpm/(?!(package-a|package-b)@)', | ||
'<rootDir>/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)', | ||
/* if config file is under '~/packages/lib-a/' */ | ||
`${path.join(__dirname, '../..')}/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)`, | ||
/* or using relative path to match the second 'node_modules/' in 'node_modules/.pnpm/@[email protected]/node_modules/@scope/pkg-b/' */ | ||
'node_modules/(?!.pnpm|package-a|@scope/pkg-b)', | ||
], | ||
}; | ||
|
||
|
@@ -2207,7 +2211,11 @@ import type {Config} from 'jest'; | |
|
||
const config: Config = { | ||
transformIgnorePatterns: [ | ||
'<rootDir>/node_modules/.pnpm/(?!(package-a|package-b)@)', | ||
'<rootDir>/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)', | ||
/* if config file is under '~/packages/lib-a/' */ | ||
`${path.join(__dirname, '../..')}/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)`, | ||
/* or using relative path to match the second 'node_modules/' in 'node_modules/.pnpm/@[email protected]/node_modules/@scope/pkg-b/' */ | ||
'node_modules/(?!.pnpm|package-a|@scope/pkg-b)', | ||
], | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2197,13 +2197,17 @@ export default config; | |
|
||
:::tip | ||
|
||
If you use `pnpm` and need to convert some packages under `node_modules`, you need to note that the packages in this folder (e.g. `node_modules/package-a/`) have been symlinked to the path under `.pnpm` (e.g. `node_modules/.pnpm/[email protected]/node_modules/package-a/`), so using `<rootDir>/node_modules/(?!(package-a|package-b)/)` directly will not be recognized, while is to use: | ||
If you use `pnpm` and need to convert some packages under `node_modules`, you need to note that the packages in this folder (e.g. `node_modules/package-a/`) have been symlinked to the path under `.pnpm` (e.g. `node_modules/.pnpm/[email protected]/node_modules/package-a/`), so using `<rootDir>/node_modules/(?!(package-a|@scope/pkg-b)/)` directly will not be recognized, while is to use: | ||
|
||
```js tab | ||
/** @type {import('jest').Config} */ | ||
const config = { | ||
transformIgnorePatterns: [ | ||
'<rootDir>/node_modules/.pnpm/(?!(package-a|package-b)@)', | ||
'<rootDir>/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)', | ||
/* if config file is under '~/packages/lib-a/' */ | ||
`${path.join(__dirname, '../..')}/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)`, | ||
/* or using relative path to match the second 'node_modules/' in 'node_modules/.pnpm/@[email protected]/node_modules/@scope/pkg-b/' */ | ||
'node_modules/(?!.pnpm|package-a|@scope/pkg-b)', | ||
], | ||
}; | ||
|
||
|
@@ -2215,7 +2219,11 @@ import type {Config} from 'jest'; | |
|
||
const config: Config = { | ||
transformIgnorePatterns: [ | ||
'<rootDir>/node_modules/.pnpm/(?!(package-a|package-b)@)', | ||
'<rootDir>/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)', | ||
/* if config file is under '~/packages/lib-a/' */ | ||
`${path.join(__dirname, '../..')}/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)`, | ||
/* or using relative path to match the second 'node_modules/' in 'node_modules/.pnpm/@[email protected]/node_modules/@scope/pkg-b/' */ | ||
'node_modules/(?!.pnpm|package-a|@scope/pkg-b)', | ||
], | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2203,13 +2203,17 @@ export default config; | |
|
||
:::tip | ||
|
||
If you use `pnpm` and need to convert some packages under `node_modules`, you need to note that the packages in this folder (e.g. `node_modules/package-a/`) have been symlinked to the path under `.pnpm` (e.g. `node_modules/.pnpm/[email protected]/node_modules/package-a/`), so using `<rootDir>/node_modules/(?!(package-a|package-b)/)` directly will not be recognized, while is to use: | ||
If you use `pnpm` and need to convert some packages under `node_modules`, you need to note that the packages in this folder (e.g. `node_modules/package-a/`) have been symlinked to the path under `.pnpm` (e.g. `node_modules/.pnpm/[email protected]/node_modules/package-a/`), so using `<rootDir>/node_modules/(?!(package-a|@scope/pkg-b)/)` directly will not be recognized, while is to use: | ||
|
||
```js tab | ||
/** @type {import('jest').Config} */ | ||
const config = { | ||
transformIgnorePatterns: [ | ||
'<rootDir>/node_modules/.pnpm/(?!(package-a|package-b)@)', | ||
'<rootDir>/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)', | ||
/* if config file is under '~/packages/lib-a/' */ | ||
`${path.join(__dirname, '../..')}/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)`, | ||
/* or using relative path to match the second 'node_modules/' in 'node_modules/.pnpm/@[email protected]/node_modules/@scope/pkg-b/' */ | ||
'node_modules/(?!.pnpm|package-a|@scope/pkg-b)', | ||
], | ||
}; | ||
|
||
|
@@ -2221,7 +2225,11 @@ import type {Config} from 'jest'; | |
|
||
const config: Config = { | ||
transformIgnorePatterns: [ | ||
'<rootDir>/node_modules/.pnpm/(?!(package-a|package-b)@)', | ||
'<rootDir>/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)', | ||
/* if config file is under '~/packages/lib-a/' */ | ||
`${path.join(__dirname, '../..')}/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)`, | ||
/* or using relative path to match the second 'node_modules/' in 'node_modules/.pnpm/@[email protected]/node_modules/@scope/pkg-b/' */ | ||
'node_modules/(?!.pnpm|package-a|@scope/pkg-b)', | ||
], | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2203,13 +2203,17 @@ export default config; | |
|
||
:::tip | ||
|
||
If you use `pnpm` and need to convert some packages under `node_modules`, you need to note that the packages in this folder (e.g. `node_modules/package-a/`) have been symlinked to the path under `.pnpm` (e.g. `node_modules/.pnpm/[email protected]/node_modules/package-a/`), so using `<rootDir>/node_modules/(?!(package-a|package-b)/)` directly will not be recognized, while is to use: | ||
If you use `pnpm` and need to convert some packages under `node_modules`, you need to note that the packages in this folder (e.g. `node_modules/package-a/`) have been symlinked to the path under `.pnpm` (e.g. `node_modules/.pnpm/[email protected]/node_modules/package-a/`), so using `<rootDir>/node_modules/(?!(package-a|@scope/pkg-b)/)` directly will not be recognized, while is to use: | ||
|
||
```js tab | ||
/** @type {import('jest').Config} */ | ||
const config = { | ||
transformIgnorePatterns: [ | ||
'<rootDir>/node_modules/.pnpm/(?!(package-a|package-b)@)', | ||
'<rootDir>/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)', | ||
/* if config file is under '~/packages/lib-a/' */ | ||
`${path.join(__dirname, '../..')}/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)`, | ||
/* or using relative path to match the second 'node_modules/' in 'node_modules/.pnpm/@[email protected]/node_modules/@scope/pkg-b/' */ | ||
'node_modules/(?!.pnpm|package-a|@scope/pkg-b)', | ||
], | ||
}; | ||
|
||
|
@@ -2221,7 +2225,11 @@ import type {Config} from 'jest'; | |
|
||
const config: Config = { | ||
transformIgnorePatterns: [ | ||
'<rootDir>/node_modules/.pnpm/(?!(package-a|package-b)@)', | ||
'<rootDir>/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)', | ||
/* if config file is under '~/packages/lib-a/' */ | ||
`${path.join(__dirname, '../..')}/node_modules/.pnpm/(?!(package-a|@scope\\+pkg-b)@)`, | ||
/* or using relative path to match the second 'node_modules/' in 'node_modules/.pnpm/@[email protected]/node_modules/@scope/pkg-b/' */ | ||
'node_modules/(?!.pnpm|package-a|@scope/pkg-b)', | ||
], | ||
}; | ||
|
||
|