const nxPreset = require('@nx/jest/preset').default;

module.exports = {
  ...nxPreset,
  // Configure coverage reporters to include Cobertura XML reports
  coverageReporters: ['text', 'cobertura'],
  // Add Jest JUnit reporter for Azure DevOps integration
  reporters: [
    'default',
    [
      'jest-junit',
      {
        outputDirectory: 'testresults',
        outputName: 'TESTS',
        uniqueOutputName: 'true', // Needs to be a string for jest-junit
        classNameTemplate: '{classname}',
        titleTemplate: '{title}',
        ancestorSeparator: ' › ',
        usePathForSuiteName: true,
      },
    ],
  ],
  // Ensure coverage is collected from all relevant files
  collectCoverageFrom: [
    '**/*.{js,jsx,ts,tsx}',
    '!**/node_modules/**',
    '!**/vendor/**',
    '!**/*.spec.{js,jsx,ts,tsx}',
    '!**/test-setup.ts',
    '!**/index.ts',
    '!**/public-api.ts',
    '!**/generated/**',
    '!**/environments/**',
    '!**/jest.config.ts',
    '!**/type.ts',
    '!**/types.ts',
    '!**/*-type.ts',
    '!**/*.type.ts',
    '!**/tokens.ts',
  ],
};
