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

chore: upgrade to jest 25 #17896

Merged
merged 9 commits into from
Jan 25, 2020
Merged

chore: upgrade to jest 25 #17896

merged 9 commits into from
Jan 25, 2020

Conversation

SimenB
Copy link
Contributor

@SimenB SimenB commented Jan 23, 2020

Summary

The changes to the test code relate to changes in JSDOM that come with Jest 25:

Closes #17012

Test Plan

yarn test

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 23, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit d1c7d66:

Sandbox Source
jovial-chaum-9wfnj Configuration
resets value of date/time input to fix bugs in iOS Safari PR
quiet-dawn-mn9or PR

@sizebot
Copy link

sizebot commented Jan 23, 2020

No significant bundle size changes to report.

Size changes (experimental)

Generated by 🚫 dangerJS against d1c7d66

@sizebot
Copy link

sizebot commented Jan 23, 2020

No significant bundle size changes to report.

Size changes (stable)

Generated by 🚫 dangerJS against d1c7d66

@SimenB
Copy link
Contributor Author

SimenB commented Jan 23, 2020

I can update babel separately and fix the transform errors.

EDIT: #17897

@eps1lon
Copy link
Collaborator

eps1lon commented Jan 23, 2020

Bad news: custom css properties are still not working using jsdom
good news: This will be resolved in cssstyle (jsdom/cssstyle#89) and will likely not need jsdom 16.

@SimenB
Copy link
Contributor Author

SimenB commented Jan 23, 2020

will likely not need jsdom 16.

can use a custom env to get jsdom 16 in, if needed: https://www.npmjs.com/package/jest-environment-jsdom-sixteen

@eps1lon
Copy link
Collaborator

eps1lon commented Jan 24, 2020

@SimenB SimenB#837 should include all fixes to make JSDOM happy.

@trueadm might want to take a look at the change Drag-Test.internal

@trueadm
Copy link
Contributor

trueadm commented Jan 24, 2020

Can you link me to the change you’re referring to? Thanks :)

@SimenB
Copy link
Contributor Author

SimenB commented Jan 24, 2020

@eps1lon @trueadm I merged in the changes into this PR

Copy link
Contributor

@trueadm trueadm left a comment

Choose a reason for hiding this comment

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

The drag tests shouldn't need changing. It suggests something is up with JSDOM if they do? I'll take a deeper look on Monday unless @necolas has any ideas (we haven't touched this code in a while).

@eps1lon
Copy link
Collaborator

eps1lon commented Jan 24, 2020

It suggests something is up with JSDOM if they do?

As I said it's probably something with JSDOM supporting passive event listeners (see SimenB#837 (comment))

@trueadm
Copy link
Contributor

trueadm commented Jan 24, 2020

Let me look at changing the Drag tests quickly. Maybe that will help. Update: done in #17896

@trueadm
Copy link
Contributor

trueadm commented Jan 24, 2020

It would also be good to know why all the click events were changed from MouseEvents to .click(). Is this another breaking change in JSDOM?

@eps1lon
Copy link
Collaborator

eps1lon commented Jan 24, 2020

It would also be good to know why all the click events were changed from MouseEvents to .click(). Is this another breaking change in JSDOM?

I took all the time to no only fix it, but prepare a PR, annoate changes and prepare codesandboxes with actual browser behavior. Could you respond to these statements instead? It's not clear if I didn't communicate them well enough or if you just ignored them.

@necolas
Copy link
Contributor

necolas commented Jan 24, 2020

Yeah it's helpful if the context goes into the PR summary. We don't usually expect context to be found in a PR against another repo.

@trueadm
Copy link
Contributor

trueadm commented Jan 24, 2020

@eps1lon Sorry if I wasn't clear. I wasn't criticising your work – this is all awesome! I believe I'm also missing the context to the original code somewhere – I can't see any codesandboxes or comments in this PR? I don't see anything in this PR's summary about any of this.

I also wrote the above comment, before your above comments to @necolas, which help expand and clarify on points.

@necolas
Copy link
Contributor

necolas commented Jan 24, 2020

I updated the PR summary with the relevant context behind the changes

@@ -432,36 +430,40 @@ describe('ReactDOMServerIntegration', () => {
<div
style={{
lineClamp: 10,
WebkitLineClamp: 10,
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure why we have this. lineClamp isn't a valid CSS property...

@necolas
Copy link
Contributor

necolas commented Jan 24, 2020

If you could please rebase this on top of latest master, it looks good to me.

@SimenB
Copy link
Contributor Author

SimenB commented Jan 24, 2020

I won't be at a computer for a few hours, so if you could rebase that'd be sweet. If not I'll get to it later 🙂

@SimenB
Copy link
Contributor Author

SimenB commented Jan 25, 2020

Never got to it yesterday, but rebased now! 👍

@gaearon
Copy link
Collaborator

gaearon commented Jan 25, 2020

Wow this is great, thank you! Leaving for @necolas to merge.

@necolas necolas merged commit cf00812 into facebook:master Jan 25, 2020
@SimenB SimenB deleted the jest-25 branch January 25, 2020 16:43
@gaearon gaearon mentioned this pull request Mar 24, 2020
acdlite added a commit to acdlite/react that referenced this pull request Mar 24, 2020
This reverts commit cf00812.

The changes to the test code relate to changes in JSDOM that come with Jest 25:

* Several JSDOM workarounds are no longer needed.
* Several tests made assertions to match incorrect JSDOM behavior (e.g. setAttribute calls) that JSDOM has now patched to match browsers.
  * https://codesandbox.io/s/resets-value-of-datetime-input-to-fix-bugs-in-ios-safari-1ppwh
* JSDOM no longer triggers default actions when dispatching click events.
  * https://codesandbox.io/s/beautiful-cdn-ugn8f
* JSDOM fixed (jsdom/jsdom#2700) a bug so that calling focus() on an already focused element does not dispatch a FocusEvent.
* JSDOM now supports passive events.
* JSDOM has improved support for custom CSS properties.
  * But requires jsdom/cssstyle#112 to land to support webkit prefixed properties.
@acdlite
Copy link
Collaborator

acdlite commented Mar 24, 2020

Heads up, I'm reverting this in #18376 because of a Jest bug that is fixed in master but unreleased: jestjs/jest#9575

acdlite added a commit to acdlite/react that referenced this pull request Mar 24, 2020
This reverts commit cf00812.

The changes to the test code relate to changes in JSDOM that come with Jest 25:

* Several JSDOM workarounds are no longer needed.
* Several tests made assertions to match incorrect JSDOM behavior (e.g. setAttribute calls) that JSDOM has now patched to match browsers.
  * https://codesandbox.io/s/resets-value-of-datetime-input-to-fix-bugs-in-ios-safari-1ppwh
* JSDOM no longer triggers default actions when dispatching click events.
  * https://codesandbox.io/s/beautiful-cdn-ugn8f
* JSDOM fixed (jsdom/jsdom#2700) a bug so that calling focus() on an already focused element does not dispatch a FocusEvent.
* JSDOM now supports passive events.
* JSDOM has improved support for custom CSS properties.
  * But requires jsdom/cssstyle#112 to land to support webkit prefixed properties.
acdlite added a commit to acdlite/react that referenced this pull request Mar 24, 2020
This reverts commit cf00812.

The changes to the test code relate to changes in JSDOM that come with Jest 25:

* Several JSDOM workarounds are no longer needed.
* Several tests made assertions to match incorrect JSDOM behavior (e.g. setAttribute calls) that JSDOM has now patched to match browsers.
  * https://codesandbox.io/s/resets-value-of-datetime-input-to-fix-bugs-in-ios-safari-1ppwh
* JSDOM no longer triggers default actions when dispatching click events.
  * https://codesandbox.io/s/beautiful-cdn-ugn8f
* JSDOM fixed (jsdom/jsdom#2700) a bug so that calling focus() on an already focused element does not dispatch a FocusEvent.
* JSDOM now supports passive events.
* JSDOM has improved support for custom CSS properties.
  * But requires jsdom/cssstyle#112 to land to support webkit prefixed properties.
acdlite added a commit that referenced this pull request Mar 24, 2020
This reverts commit cf00812.

The changes to the test code relate to changes in JSDOM that come with Jest 25:

* Several JSDOM workarounds are no longer needed.
* Several tests made assertions to match incorrect JSDOM behavior (e.g. setAttribute calls) that JSDOM has now patched to match browsers.
  * https://codesandbox.io/s/resets-value-of-datetime-input-to-fix-bugs-in-ios-safari-1ppwh
* JSDOM no longer triggers default actions when dispatching click events.
  * https://codesandbox.io/s/beautiful-cdn-ugn8f
* JSDOM fixed (jsdom/jsdom#2700) a bug so that calling focus() on an already focused element does not dispatch a FocusEvent.
* JSDOM now supports passive events.
* JSDOM has improved support for custom CSS properties.
  * But requires jsdom/cssstyle#112 to land to support webkit prefixed properties.
gaearon added a commit to gaearon/react that referenced this pull request Apr 3, 2020
@gaearon gaearon mentioned this pull request Apr 3, 2020
gaearon added a commit that referenced this pull request Apr 3, 2020
* Revert "Revert "Upgrade to jest 25 (#17896)" (#18376)"

This reverts commit fc7835c.

* Other fixes

* Fix a broken test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants