Revert "test: common.expectsError should be a must call"#14159
Revert "test: common.expectsError should be a must call"#14159jasnell wants to merge 1 commit intonodejs:masterfrom
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.
cjihrig
left a comment
There was a problem hiding this comment.
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 |
Trott
left a comment
There was a problem hiding this comment.
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. |
gibfahn
left a comment
There was a problem hiding this comment.
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