Skip to content

Commit ecff77b

Browse files
committed
simplify babel use for primer
Signed-off-by: Adam Setch <[email protected]>
1 parent df82283 commit ecff77b

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

babel.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ module.exports = {
44
'@babel/preset-env',
55
{
66
targets: { node: 'current' },
7+
// Ensure ESM in node_modules is converted to CommonJS for Jest
8+
modules: 'commonjs',
79
},
810
],
911
],

jest.config.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ const config: Config = {
1111
'^.+\\.(ts|tsx)$': ['ts-jest', { tsconfig: { jsx: 'react-jsx' } }],
1212
'^.+\\.(js|mjs)$': 'babel-jest',
1313
},
14-
// Allow transforming specific ESM packages in node_modules
14+
// Allow transforming specific ESM packages in node_modules that ship untranspiled ESM.
15+
// @primer/* libraries rely on lit and @lit-labs/react internally for some components.
16+
// We also include GitHub web components that ship ESM-only builds.
1517
transformIgnorePatterns: [
1618
'node_modules/(?!(?:@primer/react|@primer/primitives|@primer/octicons-react|@lit-labs/react|lit|@github/relative-time-element|@github/tab-container-element)/)',
1719
],
@@ -26,4 +28,4 @@ const config: Config = {
2628
modulePathIgnorePatterns: ['<rootDir>/build', '<rootDir>/node_modules'],
2729
};
2830

29-
module.exports = config;
31+
export default config;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,4 @@
141141
"*": "biome check --fix --no-errors-on-unmatched",
142142
"*.{js,ts,tsx}": "pnpm test --findRelatedTests --passWithNoTests --updateSnapshot"
143143
}
144-
}
144+
}

0 commit comments

Comments
 (0)