diff --git a/babel.config.cjs b/babel.config.cjs index f6eb1cf..a05e9f9 100644 --- a/babel.config.cjs +++ b/babel.config.cjs @@ -1,31 +1,43 @@ module.exports = { presets: [ - ['@babel/preset-env', { - targets: { - node: 'current' - } - }], - '@babel/preset-typescript' + [ + '@babel/preset-env', + { + targets: { + node: 'current', + }, + }, + ], + [ + '@babel/preset-typescript', + { + isTSX: true, + allExtensions: true, + }, + ], ], plugins: [ // Transform import.meta for Jest compatibility - function() { + function () { return { visitor: { MetaProperty(path) { - if (path.node.meta.name === 'import' && path.node.property.name === 'meta') { + 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 - ] - } - } + ], + }, + }, }; diff --git a/jest.config.json b/jest.config.json index 5291544..68577f0 100644 --- a/jest.config.json +++ b/jest.config.json @@ -7,6 +7,7 @@ "/types/**/__tests__/**/*.test.ts", "/components/**/__tests__/**/*.test.tsx", "/tests/**/*.test.ts", + "/tests/**/*.test.tsx", "/tests/**/*.test.js" ], "collectCoverageFrom": [ @@ -25,7 +26,14 @@ "^node-fetch$": "/tests/__mocks__/node-fetch.js" }, "transform": { - "^.+\\.tsx?$": "babel-jest", + "^.+\\.tsx?$": [ + "ts-jest", + { + "tsconfig": "tsconfig.json", + "babelConfig": "babel.config.cjs", + "diagnostics": false + } + ], "^.+\\.jsx?$": "babel-jest" }, "transformIgnorePatterns": ["node_modules/(?!(@jest/transform|uuid|node-fetch)/)"],