Skip to content

jest throws Unknown option "reporters" with value ... #22152

Closed

Description

Current Behavior

Working with jest in nx monorepo. When running tests I got validation warning

Unknown option "reporters" with value ["default", ["/Users/sefcik/Work/azureDevOps/esw/WebApps/node_modules/jest-junit/index.js", {"outputDirectory": "test-reports", "outputName": "TESTS-components-report.xml"}]] was found.
This is probably a typing mistake. Fixing it will remove this message.

I am using jest-junit reporter version 16.0.0.

My jest.config.ts file looks like this:

export default {
  displayName: 'ssw-shared-legacy',
  preset: '../../jest.preset.js',
  setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
  coverageDirectory: '../../coverage/apps/ssw-shared-legacy',
  reporters: [
    'default',
    ['jest-junit', {outputDirectory: 'test-reports', outputName: 'TESTS-ssw-shared-legacy-report.xml'}],
  ],
  transform: {
    '^.+\\.(ts|mjs|js|html)$': [
      'jest-preset-angular',
      {
        tsconfig: '<rootDir>/tsconfig.spec.json',
        stringifyContentPathRegex: '\\.(html|svg)$',
      },
    ],
  },
  transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
  snapshotSerializers: [
    'jest-preset-angular/build/serializers/no-ng-attributes',
    'jest-preset-angular/build/serializers/ng-snapshot',
    'jest-preset-angular/build/serializers/html-comment',
  ],
};

Expected Behavior

I would like to run test with reporters without this warning.

GitHub Repo

No response

Steps to Reproduce

  1. Create new project via nx.
  2. Add some test.
  3. Add jest-junit reporter.
  4. Run nx run project-name:test

Nx Report

Node   : 18.19.1
OS     : darwin-arm64
npm    : 10.2.4

nx (global)        : 18.0.5
nx                 : 18.0.7
@nx/js             : 18.0.7
@nx/jest           : 18.0.7
@nx/linter         : 18.0.7
@nx/eslint         : 18.0.7
@nx/workspace      : 18.0.7
@nx/angular        : 18.0.7
@nx/cypress        : 18.0.7
@nx/devkit         : 18.0.7
@nx/eslint-plugin  : 18.0.7
@nx/plugin         : 18.0.7
@nrwl/tao          : 18.0.7
@nx/web            : 18.0.7
@nx/webpack        : 18.0.7
typescript         : 5.3.3
---------------------------------------
Community plugins:
@ng-bootstrap/ng-bootstrap : 11.0.1
@ngrx/component            : 17.1.1
@ngrx/effects              : 17.1.1
@ngrx/entity               : 17.1.1
@ngrx/eslint-plugin        : 17.1.1
@ngrx/router-store         : 17.1.1
@ngrx/schematics           : 17.1.1
@ngrx/store                : 17.1.1
@ngrx/store-devtools       : 17.1.1
devextreme-angular         : 23.1.4
devextreme-schematics      : 1.6.7
---------------------------------------
Local workspace plugins:
	 @kros-sk/nx-plugins

Failure Logs

No response

Package Manager Version

10.2.4

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

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

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions