I'm using TypeScript, ESM, npm, and ts-jest. Unfortunately, it seems that transformIgnorePatterns isn't working.
I've tried multiple configurations, but nothing has helped me run Jest with ts-jest successfully. The only workaround that worked was replacing imports with require directly in node_modules, but that's not a viable final solution.
My package.json has "type": "module". I'm using npm workspaces, my setup in the root is very similar to the one in my child package:
jest.config.ts
export default {
preset: 'ts-jest/presets/default-esm',
testEnvironment: 'node',
testMatch: ['**/*.spec.ts'],
transform: {
'^.+\\.tsx?$': ['ts-jest']
},
transformIgnorePatterns: ['/node_modules/(?!log-symbols|picocolors)']
};
ts.config.json
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "node",
"declaration": true,
"strict": true,
"incremental": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"composite": true,
"types": ["node", "jest"],
"allowImportingTsExtensions": true,
"allowJs": true,
"noEmit": true,
},
"ts-node": {
"esm": true
},
"exclude": ["node_modules"]
}
I've tried various configurations with transformIgnorePatterns, target, and module values. The issue occurs not only with picocolors but also with chalk (versions 5 and 4).

