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

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

Closed
1 of 4 tasks
LukasSefcik opened this issue Mar 5, 2024 · 2 comments
Closed
1 of 4 tasks

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

LukasSefcik opened this issue Mar 5, 2024 · 2 comments
Assignees
Labels
outdated scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx type: bug

Comments

@LukasSefcik
Copy link

LukasSefcik commented Mar 5, 2024

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

@AgentEnder AgentEnder added the scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx label Mar 5, 2024
@leosvelperez
Copy link
Member

Thanks for reporting this!

Unfortunately, this is an issue in Jest itself, which affects multiple configuration options: jestjs/jest#13576. It seems reporters was fixed, but the change was not released for 29.x.x (jestjs/jest@04204e4).

I'm going to close this since it's an issue upstream and it's not actionable by us. Once the change is released and we add support for Jest 30, the warning will disappear.

Copy link

github-actions bot commented May 3, 2024

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx type: bug
Projects
None yet
Development

No branches or pull requests

3 participants