Codesandbox-client: JSDOM is out of date

Created on 10 Jul 2020  路  1Comment  路  Source: codesandbox/codesandbox-client

馃悰 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 |

馃悰 Bug

Most helpful comment

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.

>All comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

loilo picture loilo  路  22Comments

mescalito picture mescalito  路  65Comments

gautamarora picture gautamarora  路  30Comments

bcbrian picture bcbrian  路  33Comments

jthegedus picture jthegedus  路  21Comments