feat: configure Jest testing infrastructure

- Update Jest config with module name mapping for uuid and node-fetch
- Add Babel transform for mixed JS/TS support
- Configure transformIgnorePatterns for ES modules
- Add comprehensive test mocks for uuid and node-fetch
- Setup import.meta environment variables for Jest compatibility
- Increase test timeout to 30 seconds for integration tests
This commit is contained in:
William Valentin
2025-09-07 15:20:59 -07:00
parent 315303b120
commit c5d3631cb6
5 changed files with 185 additions and 5 deletions

31
babel.config.cjs Normal file
View File

@@ -0,0 +1,31 @@
module.exports = {
presets: [
['@babel/preset-env', {
targets: {
node: 'current'
}
}],
'@babel/preset-typescript'
],
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
]
}
}
};