From 7be4e5662c0f30d3d71a59c638e924a7c4988d1a Mon Sep 17 00:00:00 2001 From: davidroeca Date: Wed, 21 Feb 2024 13:51:54 -0500 Subject: [PATCH] add caution note to '.' usage in moduleDirectories resolves #10498 --- docs/Configuration.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/Configuration.md b/docs/Configuration.md index e14fb57dfd74..063c00f136b9 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -938,6 +938,12 @@ const config: Config = { export default config; ``` +:::caution + +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. + +::: + ### `moduleFileExtensions` \[array<string>] Default: `["js", "mjs", "cjs", "jsx", "ts", "mts", "cts", "tsx", "json", "node"]`