-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
common.mustCall() is added #34920
common.mustCall() is added #34920
Conversation
Please enter the commit message for your changes. Lines starting
@@ -32,19 +32,19 @@ const cp = require('child_process'); | |||
if (process.argv[2] === 'server') { | |||
// Server | |||
|
|||
const server = net.createServer(function(conn) { | |||
const server = net.createServer(common.mustCall(function(conn) { |
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.
This gives a false sense of security. This is a child process and if the child process fails, it doesn't affect the test. You can see this if you add a 2
as the second argument to common.mustCall()
so that it causes an assertion. It will print the assertion message, but the test still passes.
$ ./node test/sequential/test-net-response-size.js
Server running.
server received 65536 bytes
server received 36864 bytes
server received 1 bytes
Mismatched <anonymous> function calls. Expected exactly 2, actual 1.
at Proxy.mustCall (/Users/trott/io.js/test/common/index.js:329:10)
at Object.<anonymous> (/Users/trott/io.js/test/sequential/test-net-response-size.js:35:42)
at Module._compile (internal/modules/cjs/loader.js:1090:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1111:10)
at Module.load (internal/modules/cjs/loader.js:955:32)
at Function.Module._load (internal/modules/cjs/loader.js:796:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
$ tools/test.py test/sequential/test-net-response-size.js
[00:01|% 100|+ 1|- 0]: Done
$
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 understand that this is not so useful because common.mustcall() is enclosed in child process. Thanks for the replay and I will close the PR.
|
||
server.listen(common.PORT, '127.0.0.1', function() { | ||
server.listen(common.PORT, '127.0.0.1', common.mustCall(function() { |
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.
Same problem as above.
$ ./node test/sequential/test-net-response-size.js
Server running.
server received 65536 bytes
server received 36864 bytes
server received 1 bytes
Mismatched <anonymous> function calls. Expected exactly 2, actual 1.
at Proxy.mustCall (/Users/trott/io.js/test/common/index.js:329:10)
at Object.<anonymous> (/Users/trott/io.js/test/sequential/test-net-response-size.js:45:50)
at Module._compile (internal/modules/cjs/loader.js:1090:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1111:10)
at Module.load (internal/modules/cjs/loader.js:955:32)
at Function.Module._load (internal/modules/cjs/loader.js:796:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
$ tools/test.py test/sequential/test-net-response-size.js
[00:01|% 100|+ 1|- 0]: Done
$
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.
Welcome, @PoojaDurgad, and thanks for the pull request! I appreciate the effort, but I don't think we should do this for the reasons described in the comments.
Thanks,@Trott ,for reviewing my pull request and I understand that this is not so useful. |
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes