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

lib: add 'pid' prefix in internal/util #3878

Closed
wants to merge 1 commit into from
Closed

lib: add 'pid' prefix in internal/util #3878

wants to merge 1 commit into from

Conversation

JungMinu
Copy link
Member

This PR improves prefix in util that we've agreed on #3833
(separate PR for javascript in lib, and the original PR will be updated to move the printing function to C++ in src directly)

@cjihrig
Copy link
Contributor

cjihrig commented Nov 17, 2015

LGTM

@evanlucas
Copy link
Contributor

won't this break some tests?

@cjihrig
Copy link
Contributor

cjihrig commented Nov 17, 2015

I would imagine for any tests checking for the old string. @JungMinu did you run the tests locally with your changes?

@mscdex mscdex added the util Issues and PRs related to the built-in util module. label Nov 17, 2015
@silverwind
Copy link
Contributor

@jasnell
Copy link
Member

jasnell commented Nov 17, 2015

LGTM if CI is green

Update: ... which, it's not ... sadly. @JungMinu , can you please take a look at the failing tests and update those here as well. Thank you!

@evanlucas
Copy link
Contributor

Yea, test-deprecation-flags.js is failing

@jasnell
Copy link
Member

jasnell commented Nov 18, 2015

@JungMinu ... I'll take a look in the morning. Could you post the failure that you're seeing, however?

@martfors
Copy link
Contributor

Looking at the test message I'm guessing this is because you haven't updated the test to use your new prefix instead of the hardcoded one when comparing the two warnings.

@JungMinu
Copy link
Member Author

@jasnell I found the solution, Thanks :)

@@ -3,6 +3,7 @@ var common = require('../common');
var assert = require('assert');
var execFile = require('child_process').execFile;
var depmod = require.resolve('../fixtures/deprecated.js');
const prefix = `(${process.release.name}:${process.pid + 1}) `;
Copy link
Member

Choose a reason for hiding this comment

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

are we sure that the child process' pid will always be current+1 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

@targos would you recommend alternative to fix this? :)

Copy link
Member

Choose a reason for hiding this comment

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

I would use a RegExp to match stderr

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree, something like assert(/util\.debug is deprecated/.test(stderr)) could suffice, but you could also use the RegExp constructor to match the whole line.

Copy link
Member Author

Choose a reason for hiding this comment

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

@targos @silverwind Yup, I will update soon, Thanks :)

@JungMinu
Copy link
Member Author

@jasnell @silverwind @cjihrig Thanks, finished with RegExp:)

@jasnell
Copy link
Member

jasnell commented Nov 19, 2015

assert.equal(stderr, '(node) util.debug is deprecated. Use console.error ' +
'instead.\nDEBUG: This is deprecated\n');
const stderrResult = stderr.replace(/ *\([^)]*\) */g, '');
assert.equal(stderrResult, 'util.debug is deprecated. Use console.error ' +
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, just looking at this again. Couldn't you just assert(/util\.debug is deprecated.../.test(stderr));

@JungMinu
Copy link
Member Author

@cjihrig Sure, updated :)

@@ -16,8 +16,7 @@ execFile(node, normal, function(er, stdout, stderr) {
console.error('normal: show deprecation warning');
assert.equal(er, null);
assert.equal(stdout, '');
assert.equal(stderr, '(node) util.debug is deprecated. Use console.error ' +
'instead.\nDEBUG: This is deprecated\n');
assert(/util\.debug is deprecated.../.test(stderr));
Copy link
Contributor

Choose a reason for hiding this comment

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

Heh. I put ... in my original comment to avoid typing out the entire message. Sorry for the mix up.

Funny, this should actually still work, since . matches a single character. I don't think it's necessary to try to match the entire deprecation message verbatim. Drop the ... and this LGTM. Sorry again.

This PR improves `prefix` in `util` that we've agreed on #3833
(separate code for javascript to move the printing function to C++ directly)

lib: add 'pid' prefix in `internal/util`
@JungMinu
Copy link
Member Author

@cjihrig No problem, finished :)

@silverwind
Copy link
Contributor

@jasnell
Copy link
Member

jasnell commented Nov 20, 2015

Seeing one possibly flaky test error in CI (see https://ci.nodejs.org/job/node-test-commit-linux/1271/nodes=fedora21/console). Assuming that's an unrelated error, LGTM

@targos
Copy link
Member

targos commented Nov 20, 2015

LGTM

@cjihrig
Copy link
Contributor

cjihrig commented Nov 20, 2015

LGTM (still)

@jasnell
Copy link
Member

jasnell commented Nov 20, 2015

will get this landed!

jasnell pushed a commit that referenced this pull request Nov 20, 2015
This PR improves `prefix` in `util` that we've agreed on
#3833
(separate code for javascript to move the printing function
to C++ directly)

PR-URL: #3878
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@jasnell
Copy link
Member

jasnell commented Nov 20, 2015

Landed in d01eb68

@jasnell jasnell closed this Nov 20, 2015
@jasnell
Copy link
Member

jasnell commented Nov 20, 2015

@JungMinu ... I know that #3833 is still pending. Hopefully we can close on that one soon

@JungMinu
Copy link
Member Author

@jasnell Yes, I will finish that PR tomorrow :)

@jasnell
Copy link
Member

jasnell commented Nov 20, 2015

thank you @JungMinu !

@rvagg rvagg added the semver-major PRs that contain breaking changes and should be released in the next major version. label Dec 5, 2015
@rvagg
Copy link
Member

rvagg commented Dec 5, 2015

I believe this should be semver-major like the other changes to error messages. Tagging it as such will ensure it won't slip in to v5.x (like it just did while I was working through the list).

Please speak up if you disagree or if you think I'm reading this wrong.

@jasnell
Copy link
Member

jasnell commented Dec 5, 2015

Works for me
On Dec 4, 2015 8:47 PM, "Rod Vagg" notifications@github.com wrote:

I believe this should be semver-major like the other changes to error
messages. Tagging it as such will ensure it won't slip in to v5.x (like it
just did while I was working through the list).

Please speak up if you disagree or if you think I'm reading this wrong.


Reply to this email directly or view it on GitHub
#3878 (comment).

@JungMinu
Copy link
Member Author

JungMinu commented Dec 5, 2015

@rvagg Sounds good to me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-major PRs that contain breaking changes and should be released in the next major version. util Issues and PRs related to the built-in util module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants