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.
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
Detect open handles with done callbacks #11382
Detect open handles with done callbacks #11382
Changes from 5 commits
8c6276d
125d47b
799399e
6d47be8
944f969
bdb38fd
2088443
2adf035
ca185ca
439018f
b144f11
6eb3969
4803a6c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you use
waitUntil
instead offorceExit
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There doesn't seem to be any text that comes after the message about the open handle(s), so the best I could think to do with
waitUntil()
was to wait for the message that tests were done, then wait a few more ticks for the open handles to be printed. If I wait for the actual message about the open handles, the test would time out waiting in the error case when the handles aren't printed.--forceExit
seemed cleaner and more reliable than that. Is there a better approach I'm missing?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes more sense to match the style of the other tests which will all time out if the message is not printed.
One thing we could do in general I guess is to add a timeout to
waitUntil
and first wait for tests to complete, then wait for the handle text with a timeout. But regardless, for consistency now I prefer not usingforceExit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically this changes effect slightly. If you passed in a non-function object with a
length
property before (e.g. a non-empty string, as in this test), we’d either do what’s happening here if it had a length, or wind up wrapping it withasyncJestTest
, which would then cause an error later when the test ran and it tried to call the non-function.I think this is the right change to make, though, since it seems like it’s addressing those possible other error cases. (There’s an edge-case here: you could have passed an object with a
call()
method that I think would have worked before, but would not with this change. I’m not sure if that’s really supposed to be supported, though.)