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

fix(jest-config): allow coverageDirectory and collectCoverageFrom in project config #14180

Merged

Conversation

barbados-clemens
Copy link
Contributor

@barbados-clemens barbados-clemens commented Jun 2, 2023

Summary

jest currently warns that coverageDirectory and collectCoverageFrom as a global only option, when configured at the project level config. But the project level configuration still applies the value.

Test plan

existing tests pass

Note: this is in reference #13576
Where options are validated as invalid for the project level potentially incorrectly. There are other options that are also warned about, but the two added here are at least known to still work on the project level and appear to be used in most cases.

before
terminal output saying "coverageDirectory" is an unknown option
with change
terminal output without any warnings

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jun 2, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@netlify
Copy link

netlify bot commented Jun 2, 2023

Deploy Preview for jestjs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit abab6fc
🔍 Latest deploy log https://app.netlify.com/sites/jestjs/deploys/6492bc6a73bf9f000896f972
😎 Deploy Preview https://deploy-preview-14180--jestjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@barbados-clemens
Copy link
Contributor Author

barbados-clemens commented Jun 2, 2023

Edit: it was just an old empty folder that was causing issues. Ooops!

Trying to run tests locally result in error (running yarn test) so unable to run to update the snapshots. any guidance from the team here would be appreciated. Thanks!

Error: Whoops! Two projects resolved to the same config path: /Users/caleb/Work/facebook/jest/jest.config.mjs:

  Project 1: /Users/caleb/Work/facebook/jest/examples/enzyme
  Project 2: /Users/caleb/Work/facebook/jest
Full Output
❯ yarn test
● Validation Warning:

  Unknown option "collectCoverageFrom" with value ["**/packages/*/**/*.js", "**/packages/*/**/*.ts", "!**/bin/**", "!**/cli/**", "!**/__benchmarks__/**", "!**/__mocks__/**", "!**/__tests__/**", "!**/__typetests__/**", "!**/build/**", "!**/vendor/**", "!e2e/**"] was found.
  This is probably a typing mistake. Fixing it will remove this message.

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

● Validation Warning:

  Unknown option "projects" with value ["<rootDir>", "<rootDir>/examples/*/"] was found.
  This is probably a typing mistake. Fixing it will remove this message.

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

● Validation Warning:

  Unknown option "testTimeout" with value 70000 was found.
  This is probably a typing mistake. Fixing it will remove this message.

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

● Validation Warning:

  Unknown option "watchPlugins" with value ["/Users/caleb/Work/facebook/jest/node_modules/jest-watch-typeahead/build/file_name_plugin/plugin.js", "/Users/caleb/Work/facebook/jest/node_modules/jest-watch-typeahead/build/test_name_plugin/plugin.js"] was found.
  This is probably a typing mistake. Fixing it will remove this message.

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

Error: Whoops! Two projects resolved to the same config path: /Users/caleb/Work/facebook/jest/jest.config.mjs:

  Project 1: /Users/caleb/Work/facebook/jest/examples/enzyme
  Project 2: /Users/caleb/Work/facebook/jest

This usually means that your "projects" config includes a directory that doesn't have any configuration recognizable by Jest. Please fix it.

    at ensureNoDuplicateConfigs (/Users/caleb/Work/facebook/jest/packages/jest-config/build/index.js:322:13)
    at readConfigs (/Users/caleb/Work/facebook/jest/packages/jest-config/build/index.js:471:5)
    at async runCLI (/Users/caleb/Work/facebook/jest/packages/jest-core/build/cli/index.js:152:59)
    at async Object.run (/Users/caleb/Work/facebook/jest/packages/jest-cli/build/run.js:124:37)

@barbados-clemens barbados-clemens marked this pull request as ready for review June 2, 2023 16:12
@woppa684
Copy link

This fix only solves the issue for 2 of the options. Why not fix it for everything that is now suddenly giving these errors? E.g., "reporters" is another option that gives this warning and still works.

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@arivera-xealth
Copy link

This fix only solves the issue for 2 of the options. Why not fix it for everything that is now suddenly giving these errors? E.g., "reporters" is another option that gives this warning and still works.

Completely agree. @SimenB Can you take a look?

@SimenB
Copy link
Member

SimenB commented Jul 4, 2023

https://github.com/jestjs/jest/releases/tag/v29.6.0

@3dos
Copy link

3dos commented Jul 6, 2023

I can confirm the issue is fixed after updating jest to 29.6.0!

@github-actions
Copy link

github-actions bot commented Aug 6, 2023

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants