-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Conversation
LGTM |
won't this break some tests? |
I would imagine for any tests checking for the old string. @JungMinu did you run the tests locally with your changes? |
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! |
Yea, |
@JungMinu ... I'll take a look in the morning. Could you post the failure that you're seeing, however? |
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. |
@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}) `; |
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.
are we sure that the child process' pid will always be current+1 ?
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.
@targos would you recommend alternative to fix this? :)
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 would use a RegExp to match stderr
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.
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.
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.
@targos @silverwind Yup, I will update soon, Thanks :)
@jasnell @silverwind @cjihrig Thanks, finished with |
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 ' + |
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.
Sorry, just looking at this again. Couldn't you just assert(/util\.debug is deprecated.../.test(stderr));
@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)); |
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.
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`
@cjihrig No problem, finished :) |
LGTM pending CI: |
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 |
LGTM |
LGTM (still) |
will get this landed! |
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>
Landed in d01eb68 |
@jasnell Yes, I will finish that PR tomorrow :) |
thank you @JungMinu ! |
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. |
Works for me
|
@rvagg Sounds good to me :) |
This PR improves
prefix
inutil
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++ insrc
directly)