diff --git a/docs/Configuration.md b/docs/Configuration.md index 83140deacf05..a5a75563f514 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -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/package-a@x.x.x/node_modules/package-a/`), so using `/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/package-a@x.x.x/node_modules/package-a/`), so using `/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: [ - '/node_modules/.pnpm/(?!(package-a|package-b)@)', + '/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/@scope+pkg-b@x.x.x/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: [ - '/node_modules/.pnpm/(?!(package-a|package-b)@)', + '/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/@scope+pkg-b@x.x.x/node_modules/@scope/pkg-b/' */ + 'node_modules/(?!.pnpm|package-a|@scope/pkg-b)', ], }; diff --git a/website/versioned_docs/version-25.x/Configuration.md b/website/versioned_docs/version-25.x/Configuration.md index fe1a3ca1b996..fa0d209fe1dd 100644 --- a/website/versioned_docs/version-25.x/Configuration.md +++ b/website/versioned_docs/version-25.x/Configuration.md @@ -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/package-a@x.x.x/node_modules/package-a/`), so using `/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/package-a@x.x.x/node_modules/package-a/`), so using `/node_modules/(?!(package-a|@scope/pkg-b)/)` directly will not be recognized, while is to use: ```json { "transformIgnorePatterns": [ - "/node_modules/.pnpm/(?!(package-a|package-b)@)" + "/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 `/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>] diff --git a/website/versioned_docs/version-26.x/Configuration.md b/website/versioned_docs/version-26.x/Configuration.md index c0f0cb4ae528..14fd006cf72c 100644 --- a/website/versioned_docs/version-26.x/Configuration.md +++ b/website/versioned_docs/version-26.x/Configuration.md @@ -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/package-a@x.x.x/node_modules/package-a/`), so using `/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/package-a@x.x.x/node_modules/package-a/`), so using `/node_modules/(?!(package-a|@scope/pkg-b)/)` directly will not be recognized, while is to use: ```json { "transformIgnorePatterns": [ - "/node_modules/.pnpm/(?!(package-a|package-b)@)" + "/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 `/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>] diff --git a/website/versioned_docs/version-27.x/Configuration.md b/website/versioned_docs/version-27.x/Configuration.md index 8825d7204731..cd41e7d72168 100644 --- a/website/versioned_docs/version-27.x/Configuration.md +++ b/website/versioned_docs/version-27.x/Configuration.md @@ -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/package-a@x.x.x/node_modules/package-a/`), so using `/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/package-a@x.x.x/node_modules/package-a/`), so using `/node_modules/(?!(package-a|@scope/pkg-b)/)` directly will not be recognized, while is to use: ```json { "transformIgnorePatterns": [ - "/node_modules/.pnpm/(?!(package-a|package-b)@)" + "/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 `/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>] diff --git a/website/versioned_docs/version-28.x/Configuration.md b/website/versioned_docs/version-28.x/Configuration.md index 178cefa2169c..49313326e16d 100644 --- a/website/versioned_docs/version-28.x/Configuration.md +++ b/website/versioned_docs/version-28.x/Configuration.md @@ -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/package-a@x.x.x/node_modules/package-a/`), so using `/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/package-a@x.x.x/node_modules/package-a/`), so using `/node_modules/(?!(package-a|@scope/pkg-b)/)` directly will not be recognized, while is to use: ```json { "transformIgnorePatterns": [ - "/node_modules/.pnpm/(?!(package-a|package-b)@)" + "/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 `/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>] diff --git a/website/versioned_docs/version-29.0/Configuration.md b/website/versioned_docs/version-29.0/Configuration.md index ee893582619f..12decb540f42 100644 --- a/website/versioned_docs/version-29.0/Configuration.md +++ b/website/versioned_docs/version-29.0/Configuration.md @@ -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/package-a@x.x.x/node_modules/package-a/`), so using `/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/package-a@x.x.x/node_modules/package-a/`), so using `/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: [ - '/node_modules/.pnpm/(?!(package-a|package-b)@)', + '/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/@scope+pkg-b@x.x.x/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: [ - '/node_modules/.pnpm/(?!(package-a|package-b)@)', + '/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/@scope+pkg-b@x.x.x/node_modules/@scope/pkg-b/' */ + 'node_modules/(?!.pnpm|package-a|@scope/pkg-b)', ], }; diff --git a/website/versioned_docs/version-29.1/Configuration.md b/website/versioned_docs/version-29.1/Configuration.md index 323fb2befdd8..e0a37f55236b 100644 --- a/website/versioned_docs/version-29.1/Configuration.md +++ b/website/versioned_docs/version-29.1/Configuration.md @@ -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/package-a@x.x.x/node_modules/package-a/`), so using `/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/package-a@x.x.x/node_modules/package-a/`), so using `/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: [ - '/node_modules/.pnpm/(?!(package-a|package-b)@)', + '/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/@scope+pkg-b@x.x.x/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: [ - '/node_modules/.pnpm/(?!(package-a|package-b)@)', + '/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/@scope+pkg-b@x.x.x/node_modules/@scope/pkg-b/' */ + 'node_modules/(?!.pnpm|package-a|@scope/pkg-b)', ], }; diff --git a/website/versioned_docs/version-29.2/Configuration.md b/website/versioned_docs/version-29.2/Configuration.md index a7de359e17b1..99c13ac4bfc8 100644 --- a/website/versioned_docs/version-29.2/Configuration.md +++ b/website/versioned_docs/version-29.2/Configuration.md @@ -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/package-a@x.x.x/node_modules/package-a/`), so using `/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/package-a@x.x.x/node_modules/package-a/`), so using `/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: [ - '/node_modules/.pnpm/(?!(package-a|package-b)@)', + '/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/@scope+pkg-b@x.x.x/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: [ - '/node_modules/.pnpm/(?!(package-a|package-b)@)', + '/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/@scope+pkg-b@x.x.x/node_modules/@scope/pkg-b/' */ + 'node_modules/(?!.pnpm|package-a|@scope/pkg-b)', ], }; diff --git a/website/versioned_docs/version-29.3/Configuration.md b/website/versioned_docs/version-29.3/Configuration.md index 83140deacf05..2c387c2289df 100644 --- a/website/versioned_docs/version-29.3/Configuration.md +++ b/website/versioned_docs/version-29.3/Configuration.md @@ -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/package-a@x.x.x/node_modules/package-a/`), so using `/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/package-a@x.x.x/node_modules/package-a/`), so using `/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: [ - '/node_modules/.pnpm/(?!(package-a|package-b)@)', + '/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/@scope+pkg-b@x.x.x/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: [ - '/node_modules/.pnpm/(?!(package-a|package-b)@)', + '/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/@scope+pkg-b@x.x.x/node_modules/@scope/pkg-b/' */ + 'node_modules/(?!.pnpm|package-a|@scope/pkg-b)', ], };