-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Allow array of regexp strings for testRegex #7194
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Mind opening up a separate PR with the jest-validate changes? I think it makes sense as a separate commit in the tree. Please include an update to its readme as well 🙂 |
9a4b483
to
2a91803
Compare
I think I need to make a new PR to have it depend on the |
## Summary Split from #7194 Prerequisite to resolving #7180 This PR provides a syntax for `jest-validate` to accept more than one example for a single config value, which can be of different types. This allows overloading config options to accept multiple types. ## Test plan - existing unit tests pass (except as expected where internal config changed types) - added unit tests to cover new valid and error conditions
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. |
Summary
Resolves #7180
Creating dynamic configurations to include or exclude specific things is difficult because of inconsistency in how config allows specifying inclusions and exclusions.
testRegex
allows only a single regexptestMatch
allows an array of globstestPathIgnorePatterns
allows an array of regexpsSo there's no format (regex or glob) that can be used to build an array that works both for including and excluding.
This PR allows
testRegex
to accept an array of regex strings as well as a string, resolving this problem.Because this is the first configuration option that's overloaded with more than one valid type,
jest-validation
has also been enhanced with syntax that allows specifying more than one valid example in configuration.Test plan