-
Notifications
You must be signed in to change notification settings - Fork 272
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
Combining jsdom testEnvironment and fake timers results in timeout errors #896
Comments
We only suport If you want to test under |
Might be worth warning if that's the case? Where I work we share the same test file for web and native, and have jsdom setup for all our RNTL tests. I'll fix that, but I didn't know it could be a problem. |
Hello, we also have the same problem and as @AugustinLF pointed out, where can we found the upgrade guide for this version ? We are not aware of what action should be done to succeed an upgrade to jest 27. |
@kopax-polyconseil there are two options:
Option 1 is ideal if achievable for your code, as tests will run faster. Also, you may be able to mix both options by setting the testing environment for individual files as needed with a comment in a given test file. |
To add to @mdjastrzebski's comment:
The thing is that even though this library may work within "jsdom" environment, we can't give any guarantee on that, because we're not testing it. We advise using "node" for various reasons outlined in this thread and other ones. However, I'm happy to learn about usecases we may miss by not actively supporting "jsdom" :) |
Actually, we are using
Considering the amount of test in our project, I believe this is very hard to upgrade. This is our branch https://github.com/pass-culture/pass-culture-app-native/tree/update-jest-27 . I wonder how jest 27 as no upgrade guide considering all the change you made =/ |
@kopax-polyconseil it's unrelated to this library, but you can mock out the |
You misunderstood me, this module console-fail-test is not a logger, it is meant to fail test if they are logs. I have described the issue here since we tried the upgrade to jest 27, we are unable to fix it : JoshuaKGoldberg/console-fail-test#72 (comment) Perhaps you have a hint for us, I don't have any idea atm yet. |
how did jsdom work with jest 26 ? |
👋🏻 @MaxToyberman. As I mentioned in the original issue description (quoted below), there were a fair number of changes between Jest 26 and Jest 27 — it may be difficult to provide a concise answer to your question. Also, this issue is quite old, the project maintainers may not notice or respond to new comments. I suggest creating a new issue with details on any specific problems you encountered. 🙇🏻
|
Describe the bug
Combining
testEnvironment: 'jsdom'
and fake timers, regardless of "legacy" or "modern" timers, results in timeout errors. It would appear thatsetImmediate
does not perform as expected, breaking the built-incleanup
functionality of@testing-library/react-native
.This issue occurs in Jest 27, not Jest 26. Jest 27 includes a fair number of changes, including changes to
setImmediate
.Error Details
Expected behavior
Combining
@testing-library/react-native
,testEnvironment: 'jsdom'
, and fake timers does not cause tests to fail with timeout errors.Steps to Reproduce
npm install
npm run test
Screenshots
n/a
Versions
The text was updated successfully, but these errors were encountered: