
module.exports = {
  testEnvironment: 'jsdom',
  collectCoverage: true,
  collectCoverageFrom: [
    'src/common/**/*.(js|jsx|ts|tsx)',
  ],
  coverageThreshold: {
    global: {
      'lines': 60
    }
  },
  moduleNameMapper: {
    '^.+\\.(css|less|scss)$': 'identity-obj-proxy',

    /*
      Jest encountered issues after upgrading †o Jest v29+
        Pulled from the following jest.config.js config:
        https://gitlab-app.eng.qops.net/jroberts/next-app-fam/-/blob/51f3ae398198e4ea7b7195afbdaab813ed257cad/jest.config.js
    */
    // Workaround until uuid@v9 is released
    '^uuid$': '<rootDir>/node_modules/uuid/dist/index.js',
    // Workaround until jest supports ESM modules
    '^@react-hook/resize-observer$': '<rootDir>/node_modules/@react-hook/resize-observer/dist/main/index.js',
    // Workaround until jest supports ESM modules
    '^@react-hook/passive-layout-effect$': '<rootDir>/node_modules/@react-hook/passive-layout-effect/dist/main/index.js',
    // Workaround until jest supports ESM modules
    '^@react-hook/latest$': '<rootDir>/node_modules/@react-hook/latest/dist/main/index.js',
  },
  reporters: [
    'default',
    [
      'jest-junit',
      {
        outputDirectory: 'coverage'
      }
    ]
  ],
  coverageReporters: [
    'cobertura',
    'html'
  ],
};
