-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
Revert "test: common.expectsError should be a must call" #14159
Conversation
This reverts commit 1b2733f. Using `common.expectsError()` should not necessarily require `common.mustCall()` and this changes unnecessarily breaks a number of test cases in the nodejs/http2 repo. There are better ways of doing this.
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.
Just out of curiosity, can you point me to a test that breaks with the existing change.
Specifically: // Do not mustCall the server side callbacks, they may or may not be called
--
// depending on the OS. The determination is based largely on operating
// system specific timings
server.on('stream', (stream) => {
stream.on('error', common.expectsError({
code: 'ERR_HTTP2_STREAM_ERROR',
type: Error,
message: 'Stream closed with error code 2'
}));
//.... Depending on the operating system, the While refactoring this is minimal, it's also a bit pointless -- that is, changing |
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.
LGTM if CI is still green. I'm a fan of less magic in common
anyway.
I would not consider this "magic", rather being more explicit... As can be seen in 1b2733f (#14088) all existing cases of |
FWIW, if I had my way, Our tests would be clearer and more self-contained if we simply wrote out the function that verifies the error. DRY in a test can be an anti-pattern. That said, my views on what is and isn't appropriate for |
Which it does now 😄 |
Optionally. Which: ugh. But yes, you are correct and my comment there misses the mark.
In principle, yes. Unfortunately, assert.deepStrictEqual(new Error('foo'), new Error('bar')); // surprise! this passes! On the upside, there's no reason someone can't submit a PR to fix that shortcoming. |
Ack. That's a good idea, so we stop patchwork cycle. |
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.
Marking as Request changes
as I think there was some discussion in #14088 (comment) that hasn't been finished (to make sure this doesn't get landed by mistake).
Happy for this to land if @jasnell still wants this after reading that (feel free to dismiss this review).
My only feeling on this would be that having |
Not all that happy about this but it's not important enough to fight :-) |
This reverts commit 1b2733f. (#14088)
Using
common.expectsError()
should not necessarily requirecommon.mustCall()
and this changes unnecessarily breaks anumber of test cases in the nodejs/http2 repo. There are
better ways of doing this.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test