[Bug]: Multiple uses of a preprocessor in the transform
option will have custom config overwritten
#13769
Labels
transform
option will have custom config overwritten
#13769
Version
29.3.1
Steps to reproduce
README.md
file to understand the bug and how to test.yarn install
to install dependenciesjest.config.js
file to enable one of the four provided scenariosyarn test
to observe the effects of thejest.config.js
fileExpected behavior
When I specify multiple
transform
entries in the Jest configuration object that (1) use the same preprocessor, (2) have differing match patterns, and (3) have differing custom preprocessor configurations, then I expect the correct preprocessor configuration to be used based on the file being transformed.Consider the following
transform
object (note that this is a nonsensical configuration, meant only to illustrate the problem):When Jest transforms
.ts
files, then I expectprocessor
to be used withCONFIG_1
. Likewise, when.js
files are transformed, thenprocessor
should be passedCONFIG_2
.Actual behavior
The latest entry of a given processor will always overwrite the configuration of all other uses of that processor. This means that, provided the same example above, whenever
processor
is used, it will always be passedCONFIG_2
(even for.ts
files!).Additional context
As mentioned in the example repository, this is caused by the
transformCache
and how it caches transformer configuration solely based on the preprocessor path.Environment
The text was updated successfully, but these errors were encountered: