Skip to content

Commit 4280a31

Browse files
authored
docs: Add caution note to '.' usage in moduleDirectories (#14913)
1 parent 68dca2a commit 4280a31

File tree

5 files changed

+30
-0
lines changed

5 files changed

+30
-0
lines changed

docs/Configuration.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,12 @@ const config: Config = {
938938
export default config;
939939
```
940940

941+
:::caution
942+
943+
It is discouraged to use `'.'` as one of the `moduleDirectories`, because this prevents scoped packages such as `@emotion/react` from accessing packages with the same subdirectory name (`react`). See [this issue](https://github.com/jestjs/jest/issues/10498) for more details. In most cases, it is preferable to use the [moduleNameMapper](#modulenamemapper-objectstring-string--arraystring) configuration instead.
944+
945+
:::
946+
941947
### `moduleFileExtensions` \[array<string>]
942948

943949
Default: `["js", "mjs", "cjs", "jsx", "ts", "mts", "cts", "tsx", "json", "node"]`

website/versioned_docs/version-29.4/Configuration.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,12 @@ const config: Config = {
929929
export default config;
930930
```
931931

932+
:::caution
933+
934+
It is discouraged to use `'.'` as one of the `moduleDirectories`, because this prevents scoped packages such as `@emotion/react` from accessing packages with the same subdirectory name (`react`). See [this issue](https://github.com/jestjs/jest/issues/10498) for more details. In most cases, it is preferable to use the [moduleNameMapper](#modulenamemapper-objectstring-string--arraystring) configuration instead.
935+
936+
:::
937+
932938
### `moduleFileExtensions` \[array<string>]
933939

934940
Default: `["js", "mjs", "cjs", "jsx", "ts", "tsx", "json", "node"]`

website/versioned_docs/version-29.5/Configuration.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,12 @@ const config: Config = {
929929
export default config;
930930
```
931931

932+
:::caution
933+
934+
It is discouraged to use `'.'` as one of the `moduleDirectories`, because this prevents scoped packages such as `@emotion/react` from accessing packages with the same subdirectory name (`react`). See [this issue](https://github.com/jestjs/jest/issues/10498) for more details. In most cases, it is preferable to use the [moduleNameMapper](#modulenamemapper-objectstring-string--arraystring) configuration instead.
935+
936+
:::
937+
932938
### `moduleFileExtensions` \[array<string>]
933939

934940
Default: `["js", "mjs", "cjs", "jsx", "ts", "tsx", "json", "node"]`

website/versioned_docs/version-29.6/Configuration.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,12 @@ const config: Config = {
929929
export default config;
930930
```
931931

932+
:::caution
933+
934+
It is discouraged to use `'.'` as one of the `moduleDirectories`, because this prevents scoped packages such as `@emotion/react` from accessing packages with the same subdirectory name (`react`). See [this issue](https://github.com/jestjs/jest/issues/10498) for more details. In most cases, it is preferable to use the [moduleNameMapper](#modulenamemapper-objectstring-string--arraystring) configuration instead.
935+
936+
:::
937+
932938
### `moduleFileExtensions` \[array<string>]
933939

934940
Default: `["js", "mjs", "cjs", "jsx", "ts", "tsx", "json", "node"]`

website/versioned_docs/version-29.7/Configuration.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,12 @@ const config: Config = {
929929
export default config;
930930
```
931931

932+
:::caution
933+
934+
It is discouraged to use `'.'` as one of the `moduleDirectories`, because this prevents scoped packages such as `@emotion/react` from accessing packages with the same subdirectory name (`react`). See [this issue](https://github.com/jestjs/jest/issues/10498) for more details. In most cases, it is preferable to use the [moduleNameMapper](#modulenamemapper-objectstring-string--arraystring) configuration instead.
935+
936+
:::
937+
932938
### `moduleFileExtensions` \[array<string>]
933939

934940
Default: `["js", "mjs", "cjs", "jsx", "ts", "tsx", "json", "node"]`

0 commit comments

Comments
 (0)