-
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: refactor the code in test-dns-ipv4 #10200
Conversation
Can't we also get rid of the |
@@ -39,119 +39,124 @@ function checkWrap(req) { | |||
} | |||
|
|||
TEST(function test_resolve4(done) { | |||
var req = dns.resolve4('www.google.com', function(err, ips) { | |||
const req = dns.resolve4('www.google.com', | |||
common.mustCall(function(err, ips) { | |||
if (err) throw err; |
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.
Would you mind replacing all of these lines in the file with assert.ifError(err);
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.
will perform these changes later tonight
b94e4c3
to
e5bc1ca
Compare
var req = dns.resolve4('www.google.com', function(err, ips) { | ||
if (err) throw err; | ||
const req = dns.resolve4('www.google.com', | ||
common.mustCall(function(err, ips) { |
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'd rather either see this indented or use an arrow function to keep it on the previous line. If you go the arrow function route, we should be more consistent though and use it for the other callbacks too.
Same goes for the other instances below.
const assert = require('assert'); | ||
const common = require('../common'); |
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.
common
should be require
d before anything else.
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.
will do this change too after get the #10219 approved, I am learning the right format for the code
* remove the manual control for functions execution * use common.mustCall to control the functions execution automatically * use let and const instead of var * use assert.strictEqual instead assert.equal
e5bc1ca
to
286641c
Compare
changed the style to match the one agreed in #10219 |
any update on this one? |
|
@italoacasas I think you meant @nodejs/collaborators |
* remove the manual control for functions execution * use common.mustCall to control the functions execution automatically * use let and const instead of var * use assert.strictEqual instead assert.equal PR-URL: #10200 Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Landed 4d3b487 |
* remove the manual control for functions execution * use common.mustCall to control the functions execution automatically * use let and const instead of var * use assert.strictEqual instead assert.equal PR-URL: #10200 Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
* remove the manual control for functions execution * use common.mustCall to control the functions execution automatically * use let and const instead of var * use assert.strictEqual instead assert.equal PR-URL: #10200 Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
* remove the manual control for functions execution * use common.mustCall to control the functions execution automatically * use let and const instead of var * use assert.strictEqual instead assert.equal PR-URL: #10200 Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
* remove the manual control for functions execution * use common.mustCall to control the functions execution automatically * use let and const instead of var * use assert.strictEqual instead assert.equal PR-URL: #10200 Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
* remove the manual control for functions execution * use common.mustCall to control the functions execution automatically * use let and const instead of var * use assert.strictEqual instead assert.equal PR-URL: #10200 Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Checklist
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
test
Description of change
use let and const instead of var
add missing common.mustCall for anonymous functions