- Update Jest config to use ts-jest for better TypeScript support - Add TSX test file pattern support for React components - Improve Babel config with proper TypeScript preset settings - Enable better import.meta transformation for Jest compatibility
44 lines
792 B
JavaScript
44 lines
792 B
JavaScript
module.exports = {
|
|
presets: [
|
|
[
|
|
'@babel/preset-env',
|
|
{
|
|
targets: {
|
|
node: 'current',
|
|
},
|
|
},
|
|
],
|
|
[
|
|
'@babel/preset-typescript',
|
|
{
|
|
isTSX: true,
|
|
allExtensions: true,
|
|
},
|
|
],
|
|
],
|
|
plugins: [
|
|
// Transform import.meta for Jest compatibility
|
|
function () {
|
|
return {
|
|
visitor: {
|
|
MetaProperty(path) {
|
|
if (
|
|
path.node.meta.name === 'import' &&
|
|
path.node.property.name === 'meta'
|
|
) {
|
|
path.replaceWithSourceString('({ env: process.env })');
|
|
}
|
|
},
|
|
},
|
|
};
|
|
},
|
|
],
|
|
env: {
|
|
test: {
|
|
plugins: [
|
|
// Additional test-specific plugins can go here
|
|
],
|
|
},
|
|
},
|
|
};
|