Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error: Unknown option "coverageReporters" with value ["lcov", "text", "text-summary"] was found. #15387

Closed
1 task done
sunpietro opened this issue Nov 22, 2024 · 1 comment

Comments

@sunpietro
Copy link

sunpietro commented Nov 22, 2024

Please do not submit this issue.

I have the following config in jest.config.ts:

import type { Config } from 'jest';

// eslint-disable-next-line @typescript-eslint/no-require-imports
require('identity-obj-proxy');
// eslint-disable-next-line @typescript-eslint/no-require-imports
require('jest-environment-jsdom');

const config: Config = {
  preset: 'ts-jest',
  testEnvironment: 'jsdom',
  rootDir: '../',
  moduleNameMapper: {
    '.(css)$': 'identity-obj-proxy',
    '@actions/(.*)': '<rootDir>/actions/$1',
    '@app/(.*)': '<rootDir>/app/$1',
    '@components/(.*)': '<rootDir>/components/$1',
    '@domains/(.*)': '<rootDir>/domains/$1',
    '@locales/(.*)': '<rootDir>/locales/$1',
    '@pages/(.*)': '<rootDir>/pages/$1',
    '@styles/(.*)': '<rootDir>/styles/$1',
    '@tests/(.*)': '<rootDir>/tests/$1',
    '^d3-(.*)$': `<rootDir>/node_modules/d3-$1/dist/d3-$1`,
    'react-markdown':
      '<rootDir>/node_modules/react-markdown/react-markdown.min.js',
  },
  transform: {
    '^.+\\.(t|j)sx?$': [
      '@swc/jest',
      {
        sourceMaps: true,
        minify: false,
        jsc: {
          parser: {
            syntax: 'typescript',
            tsx: true,
            decorators: false,
            dynamicImport: false,
          },
          transform: {
            react: {
              runtime: 'automatic',
            },
          },
        },
        module: {
          type: 'commonjs',
        },
      },
    ],
  },
  moduleFileExtensions: ['js', 'ts', 'jsx', 'tsx'],
  setupFilesAfterEnv: ['./tests/setup-client.ts'],
  coveragePathIgnorePatterns: ['^.*WithLoading.tsx$'],
  collectCoverageFrom: [
    './domains/**/*.*'
  ],
  coverageReporters: ['lcov', 'text', 'text-summary'],
  coverageThreshold: {
    global: {
      branches: 60,
      functions: 70,
      lines: 80,
      statements: 80,
    },
    './components/': {
      branches: 80,
      functions: 80,
      lines: 80,
      statements: 80,
    },
  },
  testMatch: [
    '**/components/**/*.test.[jt]s?(x)',
    '**/domains/**/*.test.[jt]s?(x)',
    '**/tests/**/*.test.[jt]s?(x)',
  ],
};

export default config;

and I'm getting the following error:

● Validation Warning:

  Unknown option "coverageReporters" with value ["lcov", "text", "text-summary"] was found.
  This is probably a typing mistake. Fixing it will remove this message.

  Configuration Documentation:
  https://jestjs.io/docs/configuration

How can I fix that?

packages

    "jest": "^29.7.0",
    "jest-environment-jsdom": "^29.7.0",
    "jest-fetch-mock": "^3.0.3",
  • I understand
Copy link

Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant