Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Update Configuration.md for added special notes on usage scenarios for pnpm. #13115

Merged
merged 7 commits into from
Aug 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/package-a@x.x.x/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/package-a@x.x.x/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/package-a@x.x.x/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/package-a@x.x.x/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/package-a@x.x.x/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/package-a@x.x.x/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