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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSDOM is out of date #4530

Closed
nickmccurdy opened this issue Jul 10, 2020 · 1 comment 路 Fixed by #4539
Closed

JSDOM is out of date #4530

nickmccurdy opened this issue Jul 10, 2020 · 1 comment 路 Fixed by #4539

Comments

@nickmccurdy
Copy link

nickmccurdy commented Jul 10, 2020

馃悰 bug report

Description of the problem

It seems like Code sandbox has an old version of JSDOM (4.0.0) hard coded into the bundle: https://github.com/codesandbox/codesandbox-client/pull/1812/files#diff-3fcdeb2de813a974b29d8610b234c7f2R51

How has this issue affected you? What are you trying to accomplish?

Testing Library users have been having issues like testing-library/user-event#391 which are caused by bugs in JSDOM that have since been fixed in newer versions. This could theoretically affect any project running Jest tests that rely on JSDOM though (including create-react-app's default configuration).

Suggested fix

For reference, it seems like Jest is currently using JSDOM 12, and in the future will be using JSDOM 16. It would be nice if we could either automatically detect Jest's version of JSDOM or use the latest dynamically via Unpkg/npm. If that's not possible, just upgrading the hard coded version to 12 or 16 should help a lot. I would have tried to do this myself, but JSDOM doesn't seem to release a single bundle file any more.

Link to sandbox: link

If you download this and run the test script locally, it will pass because Jest is using a newer version of JSDOM that fixes the bug with the initial values of selectionStart and selectionEnd. This is also the same behavior if you run similar code in a browser.

Your Environment

Software Name/Version
小odesandbox latest at the time of issue
Browser N/A
Operating System N/A
@CompuIves
Copy link
Member

This is a good point! Just opened a PR for it, I think the best long term solution would be to indeed dynamically install JSDOM, but with the current version it would create quite a slowdown. That's why we have some preprocessing tied to it right now. I automated that part now though, so it becomes easier to stay up to date.

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

Successfully merging a pull request may close this issue.

3 participants