diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d20bd7f4391..b091dc462716 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ * `[docs]` Describe the order of execution of describe and test blocks. ([#5217](https://github.com/facebook/jest/pull/5217), [#5238](https://github.com/facebook/jest/pull/5238)) +* `[docs]` Add a note on `moduleNameMapper` ordering. ([#5249](https://github.com/facebook/jest/pull/5249)) ## jest 22.0.4 diff --git a/docs/Configuration.md b/docs/Configuration.md index 2c5cf6fb52b4..5641f487e6b4 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -386,6 +386,9 @@ Example: } ``` +The order in which the mappings are defined matters. Patterns are checked one +by one until one fits. The most specific rule should be listed first. + _Note: If you provide module name without boundaries `^$` it may cause hard to spot errors. E.g. `relay` will replace all modules which contain `relay` as a substring in its name: `relay`, `react-relay` and `graphql-relay` will all be