Skip to content

Commit dfd79bd

Browse files
committed
build: update jest config to map babel-plugin to compiler source
1 parent eca92ff commit dfd79bd

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

scripts/jest/config.base.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ module.exports = {
66
'<rootDir>/scripts/rollup/shims/',
77
'<rootDir>/scripts/bench/',
88
],
9+
moduleNameMapper: {
10+
'^babel-plugin-react-compiler$':
11+
'<rootDir>/compiler/packages/babel-plugin-react-compiler/src/index.ts',
12+
},
913
transform: {
1014
'^.+\\.ts$': [
1115
'babel-jest',

scripts/jest/config.build-devtools.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ moduleNameMapper['^react-reconciler/([^/]+)$'] =
5656
module.exports = Object.assign({}, baseConfig, {
5757
// Redirect imports to the compiled bundles
5858
moduleNameMapper: {
59+
...baseConfig.moduleNameMapper,
5960
...devtoolsRegressionConfig.moduleNameMapper,
6061
...moduleNameMapper,
6162
},

scripts/jest/config.build.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const packages = readdirSync(packagesRoot).filter(dir => {
3232
});
3333

3434
// Create a module map to point React packages to the build output
35-
const moduleNameMapper = {};
35+
const moduleNameMapper = {...baseConfig.moduleNameMapper};
3636

3737
// Allow bundle tests to read (but not write!) default feature flags.
3838
// This lets us determine whether we're running in different modes
@@ -53,6 +53,8 @@ moduleNameMapper['use-sync-external-store/shim/with-selector'] =
5353
`<rootDir>/build/${NODE_MODULES_DIR}/use-sync-external-store/shim/with-selector`;
5454
moduleNameMapper['use-sync-external-store/shim/index.native'] =
5555
`<rootDir>/build/${NODE_MODULES_DIR}/use-sync-external-store/shim/index.native`;
56+
moduleNameMapper['^babel-plugin-react-compiler$'] =
57+
'<rootDir>/compiler/packages/babel-plugin-react-compiler/src/index.ts';
5658

5759
module.exports = Object.assign({}, baseConfig, {
5860
// Redirect imports to the compiled bundles

0 commit comments

Comments
 (0)