Closed simPod closed 12 months ago
Ok I had this in my drawer for 2 weeks. When I finally decide to ask for help I find the solution.
I ditched ts-jest
in favor of babel
/** @type {import('jest').Config} */
module.exports = {
coverageReporters: ['text', 'cobertura'],
extensionsToTreatAsEsm: ['.ts'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
testEnvironment: 'jsdom',
transform: {
'\\.[tj]sx?$': ['babel-jest', { configFile: './babel.config.test.cjs' }],
},
transformIgnorePatterns: ['node_modules/(?!@sindresorhus)'],
};
babel config:
module.exports = {
presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'],
};
Hello, is there any chance anyone stumbled upon the same issue?
I installed
is
on the project. Everything works fine except jest tests.I'm using
"type": "module"
in my package.json and jest won't compileis
:My jest config looks like this, it uses ts-jest: