-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
test: wrap expectsError in mustCall #14088
Conversation
67c6580
to
9d4451d
Compare
@nodejs/testing |
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.
Documentation added |
@BridgeAR I've rebased at refack@0c31246 PTAL |
5d16d64
to
d950beb
Compare
Wrap expectsError in mustCall to make sure it's really called as expected. PR-URL: nodejs#14088 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
d950beb
to
1b2733f
Compare
Extra sanity on |
I missed this PR because I was on vacation last week. I'm not a fan of this at all and now have to go through and refactor a number of http2 tests I've written to account for this. For example, there are a couple of tests where an error might be reported and should only be checked if it actually is. For those, I've done What would have been better is adding an option such that: common.expectsError({
code: '...',
type: Error,
message: '...',
mustCall: 2}); Wherein if the |
@jasnell hm, instead of making the mustCall optional, I think it would be better to explicitly opt-out of that. So maybe a good follow up PR would be to add a |
-1 to opt out. The semantics of |
So far there was not a single test that was not a |
|
I'm already fixing the tests. It's not all bad :-) ... it did help me find a bug in a test that I accidentally had not completed 100%, but there are a couple of cases where this change is a bit unfortunate. For instance, in one case, whether or not the |
@jasnell as you already fixed the tests and also had a benefit because of this: do you still want to revert it? |
I guess we could have an alternate function that doesn't do the |
I don't want to 👎 but it seems like the case mentioned above is an exception to the rule, and shouldn't necessitate a new method. As usual the discussion if getting fragmented #14159 (comment). Gist:
|
Agreed that if it's only used in 1 or 2 places it's probably not worth pulling it out into I was thinking about whether you could just use 👎 is fine, polite disagreement is what it's there for! |
This doesn’t land cleanly on 8.x; if you can, please follow the guide and raise a backport PR. |
Should this be backported to |
This function does not exist in v.6 so backporting is obsolete. |
To make sure that all expectsError calls are indeed called, wrap them in mustCall.
By doing so I found one obsolete expectsError call in the tests.
I think it's nice to have the exact number of calls but having a minimum would also be good if the churn is unwanted.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test