-
-
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 for added special notes on usage scenar…
…ios for pnpm. (#13115) Co-authored-by: Gao Sheng <[email protected]>
- Loading branch information
那里好脏不可以
and
Gao Sheng
authored
Aug 22, 2022
1 parent
fb1c53d
commit 8c56d74
Showing
6 changed files
with
111 additions
and
0 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 |
---|---|---|
|
@@ -2183,6 +2183,37 @@ const config: Config = { | |
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/pakcage-a/`), so using `<rootdir>/node_modules/(?!(package-a|package-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)@)', | ||
], | ||
}; | ||
|
||
module.exports = config; | ||
``` | ||
|
||
```ts tab | ||
import type {Config} from 'jest'; | ||
|
||
const config: Config = { | ||
transformIgnorePatterns: [ | ||
'<rootdir>/node_modules/.pnpm/(?!(package-a|package-b)@)', | ||
], | ||
}; | ||
|
||
export default config; | ||
``` | ||
|
||
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. | ||
|
||
::: | ||
|
||
### `unmockedModulePathPatterns` \[array<string>] | ||
|
||
Default: `[]` | ||
|
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 |
---|---|---|
|
@@ -1340,6 +1340,22 @@ 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/pakcage-a/`), so using `<rootdir>/node_modules/(?!(package-a|package-b)/)` directly will not be recognized, while is to use: | ||
|
||
```json | ||
{ | ||
"transformIgnorePatterns": [ | ||
"<rootdir>/node_modules/.pnpm/(?!(package-a|package-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. | ||
|
||
::: | ||
|
||
### `unmockedModulePathPatterns` \[array<string>] | ||
|
||
Default: `[]` | ||
|
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 |
---|---|---|
|
@@ -1340,6 +1340,22 @@ 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/pakcage-a/`), so using `<rootdir>/node_modules/(?!(package-a|package-b)/)` directly will not be recognized, while is to use: | ||
|
||
```json | ||
{ | ||
"transformIgnorePatterns": [ | ||
"<rootdir>/node_modules/.pnpm/(?!(package-a|package-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. | ||
|
||
::: | ||
|
||
### `unmockedModulePathPatterns` \[array<string>] | ||
|
||
Default: `[]` | ||
|
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 |
---|---|---|
|
@@ -1409,6 +1409,22 @@ 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/pakcage-a/`), so using `<rootdir>/node_modules/(?!(package-a|package-b)/)` directly will not be recognized, while is to use: | ||
|
||
```json | ||
{ | ||
"transformIgnorePatterns": [ | ||
"<rootdir>/node_modules/.pnpm/(?!(package-a|package-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. | ||
|
||
::: | ||
|
||
### `unmockedModulePathPatterns` \[array<string>] | ||
|
||
Default: `[]` | ||
|
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 |
---|---|---|
|
@@ -1647,6 +1647,22 @@ 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/pakcage-a/`), so using `<rootdir>/node_modules/(?!(package-a|package-b)/)` directly will not be recognized, while is to use: | ||
|
||
```json | ||
{ | ||
"transformIgnorePatterns": [ | ||
"<rootdir>/node_modules/.pnpm/(?!(package-a|package-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. | ||
|
||
::: | ||
|
||
### `unmockedModulePathPatterns` \[array<string>] | ||
|
||
Default: `[]` | ||
|
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 |
---|---|---|
|
@@ -1651,6 +1651,22 @@ 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/pakcage-a/`), so using `<rootdir>/node_modules/(?!(package-a|package-b)/)` directly will not be recognized, while is to use: | ||
|
||
```json | ||
{ | ||
"transformIgnorePatterns": [ | ||
"<rootdir>/node_modules/.pnpm/(?!(package-a|package-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. | ||
|
||
::: | ||
|
||
### `unmockedModulePathPatterns` \[array<string>] | ||
|
||
Default: `[]` | ||
|