add babel auto import to jest test section of config #193
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@peterp Continuing the work from #152 which I thought was working when testing locally (I think my yarn lock was keeping packages I had removed).
Previously, I tried to move the auto-import from Webpack to Babel, which worked for Jest but did not work for running the development environment. When I read your recent doc about where/how we build, it seems that Webpack only is how we're building the web/ side, and not our file
core/config/babel-preset.js
. Researching a bit further about babel, I think I now understand this code:and this
is effectively a switch to use the included settings only to transpile in the case Jest is being run.
Am I correct?
If so, the changes in this PR include adding the auto-import to the "Web" section of the babel config file. I've kept the auto-import settings in Webpack.
My local testing confirms the
yarn rw test
command now runs correctly (and passes) using the updated test templates in master redwood branch, which do not import React and gql implicitly. And the commandyarn rw dev
also runs as expected with no browser errors.Are we there? Finally?!?