Skip to content

Commit

Permalink
docs: Update Configuration.md for added special notes on usage scenar…
Browse files Browse the repository at this point in the history
…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
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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&lt;string&gt;]

Default: `[]`
Expand Down
16 changes: 16 additions & 0 deletions website/versioned_docs/version-25.x/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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&lt;string&gt;]

Default: `[]`
Expand Down
16 changes: 16 additions & 0 deletions website/versioned_docs/version-26.x/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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&lt;string&gt;]

Default: `[]`
Expand Down
16 changes: 16 additions & 0 deletions website/versioned_docs/version-27.x/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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&lt;string&gt;]

Default: `[]`
Expand Down
16 changes: 16 additions & 0 deletions website/versioned_docs/version-28.0/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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&lt;string&gt;]

Default: `[]`
Expand Down
16 changes: 16 additions & 0 deletions website/versioned_docs/version-28.1/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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&lt;string&gt;]

Default: `[]`
Expand Down

0 comments on commit 8c56d74

Please sign in to comment.