-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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-util-debug.js #10531
Conversation
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 pending CI
FYI your Github name is set to # To change it everywhere:
git config --global user.name "Siva Prasanna"
# To change it for this one commit:
git commit --amend --no-edit --author="Siva Prasanna <sivaprasanna@gmail.com>" Whoever lands this Pull Request can do it for you as part of the landing process instead if you'd like. If you don't want to change it that's totally fine too! |
assert.equal(err, expectErr); | ||
assert.equal(out, expectOut); | ||
assert.strictEqual(err, expectErr); | ||
assert.strictEqual(out, expectOut); | ||
console.log('ok %j %j', environ, shouldWrite); |
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.
Can you remove all the console.log
s while you are here?
var util = require('util'); | ||
var debug = util.debuglog('tud'); | ||
const util = require('util'); | ||
const debug = util.debuglog('tud'); | ||
debug('this', { is: 'a' }, /debugging/); | ||
debug('number=%d string=%s obj=%j', 1234, 'asdf', { foo: 'bar' }); | ||
console.log('ok'); |
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.
You missed one here :)
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.
console.log('ok') is expected to be there because it has check at line no. 49
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.
Awww, right...
@sivaprs, it looks like something went wrong during the rebase process. This is now 17 commits. |
env: Object.assign(process.env, { NODE_DEBUG: environ }) | ||
}); | ||
|
||
expectErr = expectErr.split('%PID%').join(child.pid); | ||
|
||
var err = ''; | ||
let err = ''; | ||
child.stderr.setEncoding('utf8'); | ||
child.stderr.on('data', function(c) { |
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.
Please change anonymous functions to arrow functions
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.
Please change anonymous functions to arrow functions
child.stderr.setEncoding('utf8'); | ||
child.stderr.on('data', function(c) { | ||
err += c; | ||
}); | ||
|
||
var out = ''; | ||
let out = ''; | ||
child.stdout.setEncoding('utf8'); | ||
child.stdout.on('data', function(c) { |
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.
Please change anonymous functions to arrow functions
child.stderr.setEncoding('utf8'); | ||
child.stderr.on('data', function(c) { | ||
err += c; | ||
}); | ||
|
||
var out = ''; | ||
let out = ''; | ||
child.stdout.setEncoding('utf8'); | ||
child.stdout.on('data', function(c) { | ||
out += c; | ||
}); | ||
|
||
child.on('close', common.mustCall(function(c) { |
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.
Please change anonymous functions to arrow functions
@edsadr I don't think changing anonymous functions to arrow functions is required, you can do it if you want, but it's not actually necessary. |
* use const and let instead of var * use assert.strictEqual instead of assert.equal * use arrow functions * removed unwanted console log
@cjihrig I rebased now. PTAL. |
* use const and let instead of var * use assert.strictEqual instead of assert.equal * use arrow functions * removed unwanted console log PR-URL: #10531 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Landed in 8839d50 |
* use const and let instead of var * use assert.strictEqual instead of assert.equal * use arrow functions * removed unwanted console log PR-URL: nodejs#10531 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
* use const and let instead of var * use assert.strictEqual instead of assert.equal * use arrow functions * removed unwanted console log PR-URL: nodejs#10531 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
* use const and let instead of var * use assert.strictEqual instead of assert.equal * use arrow functions * removed unwanted console log PR-URL: #10531 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
* use const and let instead of var * use assert.strictEqual instead of assert.equal * use arrow functions * removed unwanted console log PR-URL: nodejs#10531 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
* use const and let instead of var * use assert.strictEqual instead of assert.equal * use arrow functions * removed unwanted console log PR-URL: nodejs#10531 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This will need backport URLs for v4 and v6 to land there. |
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test
Description