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
Wait for closed resources to actually close before detecting open handles #11429
Merged
SimenB
merged 9 commits into
jestjs:master
from
Mr0grog:wait-for-closed-resources-to-actually-close
May 20, 2021
Merged
Wait for closed resources to actually close before detecting open handles #11429
SimenB
merged 9 commits into
jestjs:master
from
Mr0grog:wait-for-closed-resources-to-actually-close
May 20, 2021
Commits on May 20, 2021
-
Don't detect async handles already queued to close
Some types of async resources in Node.js are not destroyed until *after* their `close` or `end` or similar callbacks and events run, leading to a situation where the `--detectOpenHandles` option can falsely flag resources that have been cleaned up in user code and are already scheduled for destruction. For example, if a test ends from the callback to `TCPServer.close()` and no other tests or lifecycle functions impose additional delays, `--detectOpenHandles` will flag the server even though it has been closed. This is the main cause of issues people encounter with Supertest (see jestjs#8554). This addresses the issue by adding a short delay before collecting open handles. Depends on jestjs#11382.
Configuration menu - View commit details
-
Copy full SHA for 0416117 - Browse repository at this point
Copy the full SHA 0416117View commit details -
Track indirectly created async resources
This fixes a test that the previous commit broke. Some commands (for example, starting a TCP/HTTP server with the `host` option) can cause other async resources to be created indire ctly (so their stack traces don't have any user code in them). Since these are still triggered by things in a user's code, we now track and show them when `--detectOpenHandles` is used. This also increases the size of stack traces in `ErrorWithStack` because some of the Node internals in these async stack traces are deep enough that the test wrapper functions we lo ok for fall off the bottom of the stack trace!
Configuration menu - View commit details
-
Copy full SHA for 0950417 - Browse repository at this point
Copy the full SHA 0950417View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1d650bf - Browse repository at this point
Copy the full SHA 1d650bfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 609aa62 - Browse repository at this point
Copy the full SHA 609aa62View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0fab1e4 - Browse repository at this point
Copy the full SHA 0fab1e4View commit details -
Configuration menu - View commit details
-
Copy full SHA for f499edc - Browse repository at this point
Copy the full SHA f499edcView commit details -
Configuration menu - View commit details
-
Copy full SHA for e5bd74f - Browse repository at this point
Copy the full SHA e5bd74fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2ab6387 - Browse repository at this point
Copy the full SHA 2ab6387View commit details -
Configuration menu - View commit details
-
Copy full SHA for afea019 - Browse repository at this point
Copy the full SHA afea019View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.