-
Notifications
You must be signed in to change notification settings - Fork 39
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
Respect --no-deprecation and process.noDeprecation #29
Comments
Also, regular Node.js deprecation warnings emit the |
This library should be respecting the command line argument. See the readme:
This is also validated in our test suite. Can you provide the following so I can see what is happening? (1) Node.js version Thank you for the report! |
This works: // test.js
const deprecate = require('depd')('my-module')
deprecate('Testing…')
While this does not (but should): // test.js
const deprecate = require('depd')('my-module')
process.noDeprecation = true
deprecate('Testing…')
|
Thanks! Sorry, I guess you were saying two separate things, the This module doesn't document or test the effect of altering |
This should be considered a bug rather than an enhancement. If you are a consumer of a package that internally uses If you are a consumer of a package that interaly uses |
I'm not sure I understand. Why would changing that property affect runtime? The documentation in Node.js is as follows: https://nodejs.org/api/process.html#process_process_nodeprecation
Forgive me if I'm wrong, but I don't think command like flags can be changed on a process after it's been started, no? I had intentionally implemented it as it is today, which is why it's not a bug, based on the description from the Node.js documentation. It's also of course consistent in that altering The deprecation mechanism as you know it in Node.js today didn't exist when the 1.0 of this module was created, so there was nothing in Node.js to copy. If this is under an improvement to bring it more in line with the built-in Node.js implementation, it seems like a new major version to me (and also perhaps just use the built-in Node.js mechanisms now that Node.js has them included?). I'm open to making changes, as I said above 👍 |
This makes me wonder if runtime changes to |
You can definitely control Node.js |
Well, this module doesn't even check
I'm aware, of course you can. I was explaining why I made the decision of the current implementation I did, and also never mentioned anything about being able to redefine |
So it seems the conversations has kind of dropped of, with my response having no follow up after waiting 15 days. If you like, you're welcome to make some pull requests, either to enhance the documentation or to add functionality to this module. One thing I noticed from re-reading through the conversation above and your code link is that of course another difference between this module and the Node.js core deprecation is that deprecations are not once-per-process like Node.js, but instead this module is meant for long-running processes and emits them once-per-unique-call-site. This if your code calls the same deprecated thing in 5 different places, your test suite will see 5 different deprecation messages for that thing with this module vs one 1 deprecation message using the Node.js core module. Your code example using But again, ultimately this module was made to implement something different from what the Node.js |
Hm, so honestly didn't read through this entire thread here, but it seems one major difference between this module and I'd be happy to open a PR to do so, but I think a one line change would fix the biggest concern here, which is that this module emits a non-standard |
Hi @freewil . So the reason Node.js uses the |
Would changing this module to use This module seems to already conform to |
Hi @freewil I want this module to use the Another issue here is that |
Here is a quote from the Node.js project collaborators (the implementor of the deprecations emitting an event PR) on this point: nodejs/node#4782 (comment)
Ultimately Node.js core ended up overloading the |
Thanks for the clarification, seems pretty crappy that core went in a different direction than userland. That was a couple years ago though, and IMO the best way forward would be to try to standardize around the newer warning events - if that means it'll be a release or two with depd/express until it's fully complete, then so be it. Node.js < 6 is no longer maintained, so I don't see much reason to continue supporting unmaintained versions of node going forward in new major versions of depd or express. |
I disagree. |
It took me ages to realise why I couldn't silence some deprecation warnings using
process.noDeprecation
- The deprecation was coming fromdepd
instead of regular Node.jsutil
and apparently the standard flag is not respected.The text was updated successfully, but these errors were encountered: