[DevTools] Fix moduleNameMapper Order in DevTools Config #24602)
We need the regression config moduleNameMapper to come before the current moduleNameMapper so when it tries to map "/^react-dom\/([^/]+)$/ it doesn't get confused. The reason is because order in which the mappings are defined matters. Patterns are checked one by one until one fits, and the most specific rule should be listed first.
Luna Ruan committed
May 23, 2022 at 14:18 UTC
1e98682dd383ca07f2819dc8987bd46cdb5fa028
2 files changed
+2
-2
packages/react-devtools-shared/src/__tests__/profilingCache-test.js
+1
-1
@@ -734,7 +734,7 @@ describe('ProfilingCache', () => {
734
}
735
});
736
737
- // @reactVersion >= 16.9
737
+ // @reactVersion >= 18.0
738
it('should calculate durations based on actual children (not filtered children)', () => {
739
store.componentFilters = [utils.createDisplayNameFilter('^Parent$')];
740
scripts/jest/config.build-devtools.js
+1
-1
@@ -51,8 +51,8 @@ moduleNameMapper['^react-reconciler/([^/]+)$'] =
51
module.exports = Object.assign({}, baseConfig, {
52
// Redirect imports to the compiled bundles
53
moduleNameMapper: {
54
- ...moduleNameMapper,
54
...devtoolsRegressionConfig.moduleNameMapper,
55
+ ...moduleNameMapper,
56
},
57
// Don't run bundle tests on -test.internal.* files
58
testPathIgnorePatterns: ['/node_modules/', '-test.internal.js$'],