From 105c25e01a95660f38a0b5098df5f28fcc9d97dd Mon Sep 17 00:00:00 2001 From: Emile Bergeron Date: Mon, 8 Jan 2018 12:00:21 -0500 Subject: [PATCH] Add moduleNameMapper ordering note to the documentation (#5249) * Add moduleNameMapper ordering note to the documentation * Add changelog entry --- CHANGELOG.md | 1 + docs/Configuration.md | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8edb37f3cea9..a95bc7d551d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,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