Skip to content

Commit 8c56d74

Browse files
那里好脏不可以Gao Sheng
andauthored
docs: Update Configuration.md for added special notes on usage scenarios for pnpm. (#13115)
Co-authored-by: Gao Sheng <[email protected]>
1 parent fb1c53d commit 8c56d74

File tree

6 files changed

+111
-0
lines changed

6 files changed

+111
-0
lines changed

docs/Configuration.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,6 +2183,37 @@ const config: Config = {
21832183
export default config;
21842184
```
21852185

2186+
:::tip
2187+
2188+
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:
2189+
2190+
```js tab
2191+
/** @type {import('jest').Config} */
2192+
const config = {
2193+
transformIgnorePatterns: [
2194+
'<rootdir>/node_modules/.pnpm/(?!(package-a|package-b)@)',
2195+
],
2196+
};
2197+
2198+
module.exports = config;
2199+
```
2200+
2201+
```ts tab
2202+
import type {Config} from 'jest';
2203+
2204+
const config: Config = {
2205+
transformIgnorePatterns: [
2206+
'<rootdir>/node_modules/.pnpm/(?!(package-a|package-b)@)',
2207+
],
2208+
};
2209+
2210+
export default config;
2211+
```
2212+
2213+
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.
2214+
2215+
:::
2216+
21862217
### `unmockedModulePathPatterns` \[array&lt;string&gt;]
21872218

21882219
Default: `[]`

website/versioned_docs/version-25.x/Configuration.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,6 +1340,22 @@ Example:
13401340
}
13411341
```
13421342

1343+
:::tip
1344+
1345+
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:
1346+
1347+
```json
1348+
{
1349+
"transformIgnorePatterns": [
1350+
"<rootdir>/node_modules/.pnpm/(?!(package-a|package-b)@)"
1351+
]
1352+
}
1353+
```
1354+
1355+
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.
1356+
1357+
:::
1358+
13431359
### `unmockedModulePathPatterns` \[array&lt;string&gt;]
13441360

13451361
Default: `[]`

website/versioned_docs/version-26.x/Configuration.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,6 +1340,22 @@ Example:
13401340
}
13411341
```
13421342

1343+
:::tip
1344+
1345+
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:
1346+
1347+
```json
1348+
{
1349+
"transformIgnorePatterns": [
1350+
"<rootdir>/node_modules/.pnpm/(?!(package-a|package-b)@)"
1351+
]
1352+
}
1353+
```
1354+
1355+
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.
1356+
1357+
:::
1358+
13431359
### `unmockedModulePathPatterns` \[array&lt;string&gt;]
13441360

13451361
Default: `[]`

website/versioned_docs/version-27.x/Configuration.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,6 +1409,22 @@ Example:
14091409
}
14101410
```
14111411

1412+
:::tip
1413+
1414+
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:
1415+
1416+
```json
1417+
{
1418+
"transformIgnorePatterns": [
1419+
"<rootdir>/node_modules/.pnpm/(?!(package-a|package-b)@)"
1420+
]
1421+
}
1422+
```
1423+
1424+
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.
1425+
1426+
:::
1427+
14121428
### `unmockedModulePathPatterns` \[array&lt;string&gt;]
14131429

14141430
Default: `[]`

website/versioned_docs/version-28.0/Configuration.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,6 +1647,22 @@ Example:
16471647
}
16481648
```
16491649

1650+
:::tip
1651+
1652+
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:
1653+
1654+
```json
1655+
{
1656+
"transformIgnorePatterns": [
1657+
"<rootdir>/node_modules/.pnpm/(?!(package-a|package-b)@)"
1658+
]
1659+
}
1660+
```
1661+
1662+
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.
1663+
1664+
:::
1665+
16501666
### `unmockedModulePathPatterns` \[array&lt;string&gt;]
16511667

16521668
Default: `[]`

website/versioned_docs/version-28.1/Configuration.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,6 +1651,22 @@ Example:
16511651
}
16521652
```
16531653

1654+
:::tip
1655+
1656+
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:
1657+
1658+
```json
1659+
{
1660+
"transformIgnorePatterns": [
1661+
"<rootdir>/node_modules/.pnpm/(?!(package-a|package-b)@)"
1662+
]
1663+
}
1664+
```
1665+
1666+
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.
1667+
1668+
:::
1669+
16541670
### `unmockedModulePathPatterns` \[array&lt;string&gt;]
16551671

16561672
Default: `[]`

0 commit comments

Comments
 (0)