-
-
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
[jest-config] Changed "Preset ... not found" validation error #8924
[jest-config] Changed "Preset ... not found" validation error #8924
Conversation
When using a jest preset that contains a general error (require('library-that-probably-does-not-exist')) the misleading "Preset ... not found" error is thrown, even though the preset is found.
The CI TS check appears to be broken |
CI failure is a lint error - the the TS warning is just a version mismatch warning (waiting for typescript-eslint/typescript-eslint#916) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Barring lint errors this LGTM. Thanks!
Codecov Report
@@ Coverage Diff @@
## master #8924 +/- ##
==========================================
- Coverage 64.29% 64.28% -0.01%
==========================================
Files 276 276
Lines 11707 11711 +4
Branches 2864 2865 +1
==========================================
+ Hits 7527 7529 +2
- Misses 3549 3550 +1
- Partials 631 632 +1
Continue to review full report at Codecov.
|
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
When using a jest preset that contains a general
Error
(not aSyntaxError
orTypeError
)jest-config
throws a"Preset ... not found"
validation error.This is somewhat misleading for users of a broken preset that may just be missing a peer dependency.
Work-around
To get around this in
jest-expo
I wrap the requires of peer dependencies in try/catch, rethrow the meaningful error message, then exit the process to prevent users from thinking the preset is missing.Test plan
As opposed to the current error message: