harb/kraiken-lib/jest.config.cjs
johba c2720c35a5 fix: configure Jest for ES modules in kraiken-lib (#88)
Updates Jest configuration to properly handle ES module syntax:
- Switch to ts-jest/presets/default-esm preset
- Add custom resolver to map .js imports to .ts source files
- Configure extensionsToTreatAsEsm for TypeScript files
- Enable useESM in ts-jest globals

This resolves module resolution errors when running tests in
kraiken-lib which uses "type": "module" in package.json.

Fixes #85

Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/88
2025-11-08 12:03:48 +01:00

13 lines
271 B
JavaScript

module.exports = {
preset: 'ts-jest/presets/default-esm',
testEnvironment: 'node',
maxWorkers: 1,
extensionsToTreatAsEsm: ['.ts'],
resolver: './jest.resolver.cjs',
globals: {
'ts-jest': {
useESM: true,
tsconfig: './tsconfig.json'
}
}
};