-
-
Notifications
You must be signed in to change notification settings - Fork 27k
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
In upgrading to 1.0.5, tests seem to be breaking due to missing globals of jsdom? #2342
Comments
Can you reproduce this on an empty project? |
ok, I think I am just seeing a weird stack trace. the new test.js script throws errors on is this change mentioned in the notes? |
that seems more like a breaking change to me FYI, but my tests will be more accurate as a result :) |
Ah, didn’t realize that’s technically a breaking change, thanks. I’ll add to the release notes. |
👍 |
ok, well, after trying to get my last couple of tests passing, I am seeing what I think is an issue. I can't tell if its how jest is setting up jsdom, or what. I can post in the jest repo as well. https://github.com/kellyrmilligan/reacttestingexamplebug comment out the
any ideas on this? |
Tagging this as needing investigation by someone motivated. |
appreciate it, I have to skip a few tests with the upgrade. |
I can also re-post in jest, as i'm guessing that may be better suited to this. |
If you do, it would be great if you could provide an isolated example without CRA for them. |
I am guessing that your test is synchronous, but app code is asynchronous. The test doesn't wait for app to finish, and so funky things can happen. Try changing your test to wait for the async app code to complete. There are examples in Jest docs for how to write async tests. If this doesn't help please let me know and we can reopen. In general it's better to report such things directly to Jest. Cheers! |
If you are reporting a bug, please fill in below. Otherwise feel free to remove this template entirely.
Can you reproduce the problem with latest npm?
yes
Many errors, especially related to "missing modules", are due to npm bugs.
If you're using Windows, follow these instructions to update npm.
If you're using OS X or Linux, run this to update npm:
Then try to reproduce the issue again.
Can you still reproduce it?
Description
on upgrading to latest 1.0 release, a few tests are breaking that previously passed.
The first test that breaks throws an error on
document.getElementId
call, gettingTypeError: Cannot read property 'getElementById' of undefined
shouldn't this be defined byjsdom
?second one is similar in nature, although it's calling it as a global without prefixing it with window.
i'm trying to track down the differences from the 0.9x stuff and 1.0. the rest of the tests I have are passing quite nicely.
Expected behavior
document
should exist in the test env.Actual behavior
Its not there.
Environment
Run these commands in the project folder and fill in their results:
npm ls react-scripts
: react-scripts@1.0.5node -v
: v6.9.2npm -v
: 3.10.9Then, specify:
Reproducible Demo
Please take the time to create a new app that reproduces the issue.
Alternatively, you could copy your app that experiences the problem and start removing things until you’re left with the minimal reproducible demo.
(Accidentally, you might get to the root of your problem during that process.)
Push to GitHub and paste the link here.
By doing this, you're helping the Create React App contributors a big time!
Demonstrable issues gets fixed faster.
The text was updated successfully, but these errors were encountered: