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

Update babel jest #32326

Closed
wants to merge 3 commits into from
Closed

Update babel jest #32326

wants to merge 3 commits into from

Conversation

mshustov
Copy link
Contributor

@mshustov mshustov commented Mar 1, 2019

Summary

As per #31825 (comment)
after merging #32168 we are good to go
Note that we run all jest tests with babel7 from now on, whereas optimizer still uses babel6. Is there an issues to track migration progress?

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@mshustov mshustov mentioned this pull request Mar 1, 2019
3 tasks
@@ -14,7 +14,7 @@ exports[`ScriptingHelpFlyout should render normally 1`] = `
<EuiTabbedContent
initialSelectedTab={
Object {
"content": <Unknown />,
"content": <ScriptingSyntax />,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

jest improved React.Fragment support
jestjs/jest#5786

@@ -6,7 +6,7 @@ exports[`FormLabel Basic initialization 1`] = `
className="euiFormLabel"
id="ml_aria_label_undefined"
/>
<Component
<JsonTooltip
Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://babeljs.io/docs/en/babel-plugin-transform-react-display-name
which is part of @babel/preset-react
supports adding displayName for React 16+ syntax

@@ -313,7 +313,7 @@ exports[`UploadLicense should display a modal when license requires acknowledgem
maxWidth={true}
onClose={[Function]}
>
<Component
<_default
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We use https://github.com/davidtheclark/focus-trap-react, which doesn't declare displayName. Seems it's a result of babel transpilation referring to export type.

@mshustov mshustov requested review from spalger and a team March 4, 2019 08:59
@mshustov mshustov marked this pull request as ready for review March 4, 2019 09:00
@mshustov mshustov requested review from a team as code owners March 4, 2019 09:00
"@babel/parser": "^7.3.4",
"@babel/polyfill": "^7.2.5",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@spalger cannot find where added @babel/polyfill in kbn-test. Seems useBuiltIns: 'entry', doesn't work there. Does it?

Copy link
Contributor

@spalger spalger Mar 5, 2019

Choose a reason for hiding this comment

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

Hmm, well kbn-test is always executed in place, so it's probably borrowing the dependencies from kibana, and since useBuiltIns: 'entry' replaces @babel/polyfill with individual requires for core-js/modules/{feature} it's probably just borrowing the core-js version required by Kibana... Not the best strategy, but I guess that's why it works. That said, we don't actually require @babel/polyfill in kbn-test. @mistic is working on converting the root babel usages to babel 7 and at that time we'll be moving from babel-polyfill to @babel/polyfill in src/setup_node_env/babel_register/polyfill.js

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if package relies on environment to provide polyfilled runtime we might want to use useBuiltIns: false https://babeljs.io/docs/en/babel-preset-env#usebuiltins-false

Copy link
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

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

ML change LGTM.

Copy link
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

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

I'm a little concerned about running the tests with babel7 while the code is using babel6 via the optimizer.

Is there a good reason to upgrade jest to babel7 before the rest of the code base?

How are you feeling about the babel7 upgrade @mistic? Do you think it's too early to move the jest tests?

@mistic
Copy link
Member

mistic commented Mar 5, 2019

@spalger as you know I'm working in a separate branch trying to push babel 7 to be used everywhere in the whole project (upgrade babel6 and replacing typescript). I think maybe we can wait for the whole babel7 change?

@mshustov
Copy link
Contributor Author

mshustov commented Mar 5, 2019

@mistic @spalger np. I can close the PR. anyway, this branch can be used later in @mistic work.
the only reason why I opened it - to move the migration process gradually. I do agree if we don't work actively on migration, I don't want to diverge tests from dev env for a long time
should I close?

@spalger
Copy link
Contributor

spalger commented Mar 7, 2019

move the migration process gradually

That does sound nice, but I'll leave it up to @mistic since he's managing the transition to babel 7. I'm always a fan of breaking the problem up into smaller chunks, I just want to make sure this chunk fits in with the rest of the plan @mistic has

@mistic
Copy link
Member

mistic commented Mar 7, 2019

@spalger @restrry those changes don't conflict with the current work I'm doing. In fact they are part of them too. The only different thing is the part for node_preset_7 as I've removed it completely because the presets are already completely upgraded for babel7.

Is up to you guys merge this or not!

@mshustov mshustov closed this Mar 8, 2019
@mshustov mshustov deleted the update-babel-jest branch March 8, 2019 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants