-
-
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
Transform to inherit default transformer if no match #8574
Comments
somewhat related #2076 |
Hey @danm, thanks for the suggestion!
|
@danm I also found this confusing, great if you can submit a PR :) |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 14 days. |
This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Pre question
Am I right in thinking that if no transform property is provided in the Jest config, Jest will use its default compiler (
babel-jest
)?If so, should the docs be updated that if a transformer isn't defined, instead of being
undefined
, it should usebabel-jest
?🚀 Feature Proposal
Entries in the
transform
property use the provided compiler, but if no file is matched, then it uses the default compiler.Motivation
It isn't clear what the default transformer is, so if adding your own to transformer, for example, an SVG, it is not obvious imo that you have to re clarify other files should use
babel-jest
.Additionally, recently Jest has changed
babel-jest
from an external dependancy to an internal one. This means, if I am using a transformer for just SVGs, I also have to tell the transformer to specifically usebabel-jest
. But what if Jest changes its mind and prefers to use a different compiler in the future, I'd have to change all transformers to make use of the new compiler.Example
No transformer selected, uses default (
babel-jest
), compiles without issueTransformer selected to deal with SVGs, but everything else fails.
Transformer selected to deal with SVGs and babel-jest defined - compiles without issue.
Proposed Example
Transformer selected to deal with SVGs and any files that do not match the transformer pattern, use default compiler. This also means that if Jest moves away from using
babel-jest
, it doesn't need to be re clarified.I could be missing something somewhere - it might just be an update to the docs. Thoughts?
The text was updated successfully, but these errors were encountered: