Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

sivaprs
Copy link
Contributor

@sivaprs sivaprs commented Dec 30, 2016

  • use const and let instead of var
  • use assert.strictEqual instead of assert.equal
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

test

Description

  • use const and let instead of var
  • use assert.strictEqual instead of assert.equal

@nodejs-github-bot nodejs-github-bot added test Issues and PRs related to the tests. lts-watch-v6.x labels Dec 30, 2016
@sivaprs
Copy link
Contributor Author

sivaprs commented Dec 30, 2016

cc @thefourtheye

@mscdex mscdex added the util Issues and PRs related to the built-in util module. label Dec 30, 2016
@lpinca
Copy link
Member

lpinca commented Dec 30, 2016

Copy link
Member

@gibfahn gibfahn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pending CI

@gibfahn
Copy link
Member

gibfahn commented Dec 30, 2016

FYI your Github name is set to sivaprasanna, people usually tend to use their full names (e.g. @thefourtheye here). If you want to change it the commands are:

# 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 <[email protected]>"

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);
Copy link
Contributor

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.logs while you are here?

@sivaprs
Copy link
Contributor Author

sivaprs commented Jan 2, 2017

cc @thefourtheye

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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You missed one here :)

Copy link
Contributor Author

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awww, right...

@cjihrig
Copy link
Contributor

cjihrig commented Jan 3, 2017

@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) {
Copy link
Member

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

Copy link
Member

@edsadr edsadr left a 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) {
Copy link
Member

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) {
Copy link
Member

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

@gibfahn
Copy link
Member

gibfahn commented Jan 3, 2017

@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.

@edsadr
Copy link
Member

edsadr commented Jan 3, 2017

@gibfahn is just a small Nit now that @sivaprs is touching the file would be a nice thing to add ... I had the same file in another PR including that... closed it in favor of this one, not a big deal anyway 🙂

* use const and let instead of var
* use assert.strictEqual instead of assert.equal
* use arrow functions
* removed unwanted console log
@sivaprs
Copy link
Contributor Author

sivaprs commented Jan 4, 2017

@cjihrig I rebased now. PTAL.

@thefourtheye
Copy link
Contributor

jasnell pushed a commit that referenced this pull request Jan 6, 2017
* 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 <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
@jasnell
Copy link
Member

jasnell commented Jan 6, 2017

Landed in 8839d50

@jasnell jasnell closed this Jan 6, 2017
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 18, 2017
* 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 <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 19, 2017
* 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 <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
targos pushed a commit that referenced this pull request Jan 28, 2017
* 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 <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
@italoacasas italoacasas mentioned this pull request Jan 29, 2017
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 30, 2017
* 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 <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 30, 2017
* 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 <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
@jasnell
Copy link
Member

jasnell commented Mar 8, 2017

This will need backport URLs for v4 and v6 to land there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests. util Issues and PRs related to the built-in util module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants