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 JSDOM and create script to automate it #4539

Merged
merged 2 commits into from
Aug 5, 2020
Merged

Conversation

CompuIves
Copy link
Member

Fixes #4530

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 11, 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 2a07c1c:

Sandbox Source
Notifications Test Configuration
Code Sandbox bug with old JSDOM version Issue #4530

@lbogdan lbogdan temporarily deployed to pr4539 July 11, 2020 14:18 Inactive
@lbogdan
Copy link
Contributor

lbogdan commented Jul 11, 2020

Build for latest commit 2a07c1c is at https://pr4539.build.csb.dev/s/new.

Copy link

@nickserv nickserv left a comment

Choose a reason for hiding this comment

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

Thanks for working on this! My only code critique is that the .js file is still being committed even though it's not used, and this isn't deleting the old ones easier. It would probably be best to rebase this PR to only add the .min.js file (so the 5MB git object for .js isn't written to the repository) and remove the old JSDOM 4 files that aren't in use any more.

@nickserv
Copy link

Unfortunately my test from #4530 is still failing with the same issue, seems like old JSDOM is still used in this sandbox: https://pr4539.build.csb.dev/s/code-sandbox-bug-with-old-jsdom-version-9gcnp?file=/index.test.js

@CompuIves
Copy link
Member Author

It would probably be best to rebase this PR to only add the .min.js file (so the 5MB git object for .js isn't written to the repository) and remove the old JSDOM 4 files that aren't in use any more.

I've decided to not remove JSDOM 4 yet, since some service workers need to request the file still. I'm planning to remove it in a month though! For the .min.js vs .js, that makes sense since we can generate one ourselves now. I'll remove the .js one!

Unfortunately my test from #4530 is still failing with the same issue, seems like old JSDOM is still used in this sandbox

Hmm, that is weird. I see the template is static, so the bundler shouldn't be running any tests there.

@nickserv
Copy link

That's still strange, if it's running tests why is it still using JSDOM (and still 4 not 12)? I could tell if it was using the real DOM because the tests would be passing. Do we need to test this without the static template and disable the test runs separately?

@marcosvega91
Copy link

marcosvega91 commented Jul 11, 2020

Just for info I have created a repo with the code that is broken on our side

https://pr4539.build.csb.dev/s/cold-currying-p7r3g?file=/src/__tests__/index.js

@nickserv
Copy link

FYI: My sandbox was based on this so should reproduce the same issue. The bug in user-event is caused by a combination of a regression (which we decided not to fix) and a bug in JSDOM (which is in Code Sandbox's version, JSDOM 4). My sandbox shows how JSDOM incorrectly marks selectionStart and selectionEnd, which causes that regression in user-event.

@CompuIves CompuIves force-pushed the update/jsdom branch 3 times, most recently from fe0d4d4 to ea2a0e8 Compare August 5, 2020 08:48
@CompuIves
Copy link
Member Author

CompuIves commented Aug 5, 2020

Picking this one up again! Apologies for the time, I lost track of this one.

I now updated JSDOM to 16.3.0, and only committed the min version, but still, getting the same error. It's really weird.

@CompuIves
Copy link
Member Author

Actually... The log does work...

image

@lbogdan lbogdan temporarily deployed to pr4539 August 5, 2020 09:04 Inactive
@CompuIves
Copy link
Member Author

Weird, this returns false:

Object.prototype.hasOwnProperty.call(element, 'selectionStart')

@CompuIves
Copy link
Member Author

Ah, it turns out this was a bug in jest-matchers that have since been fixed. I've just updated and the report now seems to work correctly on my side!

@marcosvega91
Copy link

this test is working now, so on our side we are good too 😄

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.

JSDOM is out of date
4 participants