import { join } from 'path'; import fileURLToDirname from './fileURLToDirname.js'; const thisDir = fileURLToDirname(import.meta.url); /** @type {import('@jest/types').Config.InitialOptions} */ export default { transform: { '\\.tsx?$': join(thisDir, 'jestEsbuildTransformer.js'), }, extensionsToTreatAsEsm: [ '.ts', '.tsx', ], moduleNameMapper: { '^@sophie/(.+)$': join(thisDir, '../packages/$1/src/index.ts'), '^(\\.{1,2}/.*)\\.jsx?$': '$1', // Workaround for jest to recognize the vendored dependencies of chalk. '^#ansi-styles$': join(thisDir, '../node_modules/chalk/source/vendor/ansi-styles/index.js'), '^#supports-color$': join(thisDir, '../node_modules/chalk/source/vendor/supports-color/index.js'), }, resetMocks: true, restoreMocks: true, testEnvironment: 'node', testPathIgnorePatterns: [ '/dist/', '/node_modules/', ], };