/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
  preset: "ts-jest/presets/default-esm",
  roots: ["."],
  testEnvironment: "node",
  setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
  testEnvironmentOptions: {
    NODE_ENV: "test"
  },
  transform: {
    "^.+\\.tsx?$": [
      "ts-jest",
      {
        useESM: true,
      },
    ],
  },
  moduleNameMapper: {
    "^(\\.{1,2}/.*)\\.js$": "$1",
  },
  transformIgnorePatterns: [
    'node_modules/(?!(@codeflash-ai)/)'
  ],
  extensionsToTreatAsEsm: [".ts", ".tsx"],
  testRegex: ".*\\.test\\.ts$",
  testPathIgnorePatterns: process.env.CI ? ["e2e.test.ts"] : [],
  moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
  testTimeout: 10000,
  forceExit: true,
  detectOpenHandles: false,
  clearMocks: true,
  maxWorkers: 1,
  verbose: false,
  silent: false,
}
