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 Validation Warning: Unknown option "coverageDirectory" in new, clean (Angular) repo #15752

Closed
alexciesielski opened this issue Mar 19, 2023 · 14 comments · Fixed by #18061
Assignees
Labels
blocked: third-party outdated scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx type: bug

Comments

@alexciesielski
Copy link
Contributor

alexciesielski commented Mar 19, 2023

Current Behavior

Running nx test app throws validation warnings.

> nx run app:test

● Validation Warning:

  Unknown option "coverageDirectory" with value "../../coverage/packages/app" was found.
  This is probably a typing mistake. Fixing it will remove this message.

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

Expected Behavior

Don't show validation warnings on supported config properties.

GitHub Repo

https://github.com/alexciesielski/nx-test-warning-showcase

Steps to Reproduce

  1. npx create-nx-workspace@latest => package-based monorepo => app => yes
  2. Create tsconfig.base.json (without it generating an angular app throws an error, guess this is also a bug?)
  3. npm i -D @nrwl/angular
  4. npx nx g @nrwl/angular:application --name=app
  5. nx test app => warning in console

Nx Report

nx report

 >  NX   Report complete - copy this into the issue template

   Node : 18.15.0
   OS   : darwin arm64
   npm  : 9.5.0

   nx                      : 15.8.7
   @nrwl/js                : 15.8.7
   @nrwl/jest              : 15.8.7
   @nrwl/linter            : 15.8.7
   @nrwl/workspace         : 15.8.7
   @nrwl/angular           : 15.8.7
   @nrwl/cli               : 15.8.7
   @nrwl/cypress           : 15.8.7
   @nrwl/devkit            : 15.8.7
   @nrwl/eslint-plugin-nx  : 15.8.7
   @nrwl/storybook         : 15.8.6
   @nrwl/tao               : 15.8.7
   @nrwl/webpack           : 15.8.7
   typescript              : 4.9.5
   ---------------------------------------
   The following packages should match the installed version of nx
     - @nrwl/storybook@15.8.6

   To fix this, run `nx migrate nx@15.8.7`

Failure Logs

> nx run app:test

● Validation Warning:

  Unknown option "coverageDirectory" with value "../../coverage/packages/app" was found.
  This is probably a typing mistake. Fixing it will remove this message.

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

 PASS   app  packages/app/src/app/app.component.spec.ts
  AppComponent
    ✓ should create the app (62 ms)
    ✓ should have as title 'app' (9 ms)
    ✓ should render title (9 ms)

Test Suites: 1 passed, 1 total
Tests:       3 passed, 3 total
Snapshots:   0 total
Time:        1.738 s
Ran all test suites.

Additional Information

No response

@alexciesielski alexciesielski changed the title jest throws Validation Warning: Unknown option "coverageDirectory" in new&clean repo jest throws Validation Warning: Unknown option "coverageDirectory" in new, clean (Angular) repo Mar 19, 2023
@AgentEnder AgentEnder added the scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx label Mar 20, 2023
@alexciesielski
Copy link
Contributor Author

I've now also attached a repro repo here

@nemonemi
Copy link

I can confirm to have started seeing this after updating to the latest version of the NX.

@nikbabchenko
Copy link

The same for me.
And for some reason there is no coverage report in terminal when executing command - 'nx run-many --all --target=test --coverage=true --coverageReporters='cobertura,lcov,text''

or just 'nx run-many --all --target=test --coverage=true'

@bojanbass
Copy link

+1

1 similar comment
@SaulMoro
Copy link

+1

@barbados-clemens
Copy link
Contributor

This is a bug in jest 29,
If you're not using code coverage you can remove the property for now,
But you can safely ignore this warning since the property is working.

jestjs/jest#13576

@bill-mcgrory
Copy link

If you run npx jest in the given module directory, it does not give the warnings, plus it honors the jest.config.ts file. I am having what I think is a related issue, where the reporters key is ignored (and reported as a syntax error) if I run nx test module, but if am in the module root directory, it honors the config settigns for reporters and does not complain about syntax errors.

@Fitzbert-Fitz
Copy link

we also see that no reports are generated when we see the warning. Removing the coverageDirectory fixes this for us and reports are generated again.

@ojemuyiwa
Copy link

Hi all 👋 any fix for this yet?

@barbados-clemens
Copy link
Contributor

@ojemuyiwa it is an upstream issue with jest. a fix has been merged and is waiting on a release for it.

@rhutchison
Copy link
Contributor

rhutchison commented Jul 9, 2023

Released in 29.6.0 jestjs/jest#14180 (comment)

@LayZeeDK
Copy link
Contributor

@AgentEnder Reopen this issue because of #18096

@barbados-clemens
Copy link
Contributor

going to leave closed as you can still manually bump to v29.6.x on your own. we ran into some odd memory issues so reverted in attempt to track down.
@nx/jest package show work with 29.x.x version.

@github-actions
Copy link

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 Aug 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocked: third-party outdated scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.