Uh oh!
There was an error while loading. Please reload this page.
util: adhere to noDeprecation set at runtime - #6683
Conversation
There was a problem hiding this comment.
Can you add a check that calling printDeprecationMessage() after setting process.noDeprecation to false again does emit a deprecation warning?
bnoordhuis
commented
May 11, 2016
Nice, LGTM. |
There was a problem hiding this comment.
If I am not wrong this function should not be called right? I think assert(false, 'this should not be called'); or something like this would be better I guess.
addaleax
commented
May 11, 2016
Updated based on @thefourtheye’s suggestion. |
Fishrock123
commented
May 11, 2016
Mostly LGTM, good catch. |
addaleax
commented
May 11, 2016
@Fishrock123 looking better now? :) |
Fishrock123
commented
May 11, 2016
Yeah. Another CI would be nice before landing once that nit is fixed |
fe73664 to
372ea85CompareThere was a problem hiding this comment.
this could fail if any other warnings happened to be emitted in the future. The warning object can be checked to see if it is a DeprecationWarning by looking at the name property or the message can be checked explicitly.
There was a problem hiding this comment.
That's unlikely though, is it? That would mean core is doing something internally that is worthy of warning. I'd consider that a bug.
There was a problem hiding this comment.
Wasn't commenting on the likeliness of it... just the possibility of it. ;-)
There was a problem hiding this comment.
@jasnell lol, literally what I had written here at first. But @thefourtheye made a good point, if there are other warnings emitted in the future, it’s probably best to know about that, even if that might mean having to change the test file again.
Until now, the docs stated that `process.noDeprecation` could be set at runtime, but before any modules were loaded. That was not true, because `lib/internal/util.js` was loaded during the process startup process, so setting the flag at runtime was pointless. Minimal test case: process.noDeprecation = true; process.EventEmitter; This patch moves checking `process.noDeprecation` to the place where it was actually used.
addaleax
commented
May 11, 2016
thefourtheye
commented
May 11, 2016
LGTM |
cjihrig
commented
May 13, 2016
LGTM. CI is green. |
Until now, the docs stated that `process.noDeprecation` could be set at runtime, but before any modules were loaded. That was not true, because `lib/internal/util.js` was loaded during the process startup process, so setting the flag at runtime was pointless. Minimal test case: process.noDeprecation = true; process.EventEmitter; This patch moves checking `process.noDeprecation` to the place where it was actually used. PR-URL: #6683 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
addaleax
commented
May 13, 2016
Landed in a4564f3 |
Until now, the docs stated that `process.noDeprecation` could be set at runtime, but before any modules were loaded. That was not true, because `lib/internal/util.js` was loaded during the process startup process, so setting the flag at runtime was pointless. Minimal test case: process.noDeprecation = true; process.EventEmitter; This patch moves checking `process.noDeprecation` to the place where it was actually used. PR-URL: #6683 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
- **buffer**: fix lastIndexOf and indexOf in various edge cases (Anna Henningsen) [#6511](#6511) - **child_process**: use /system/bin/sh on android (Ben Noordhuis) [#6745](#6745) - **deps**: - upgrade npm to 3.8.9 (Rebecca Turner) [#6664](#6664) - upgrade to V8 5.0.71.47 (Ali Ijaz Sheikh) [#6572](#6572) - upgrade libuv to 1.9.1 (Saúl Ibarra Corretgé) [#6796](#6796) - Intl: ICU 57 bump (Steven R. Loomis) [#6088](#6088) - **repl**: - copying tabs shouldn't trigger completion (Eugene Obrezkov) [#5958](#5958) - exports `Recoverable` (Blake Embrey) [#3488](#3488) - **src**: add O_NOATIME constant (Rich Trott) [#6492](#6492) - **src,module**: add --preserve-symlinks command line flag (James M Snell) [#6537](#6537) - **util**: adhere to `noDeprecation` set at runtime (Anna Henningsen) [#6683](#6683) As of this release the 6.X line now includes 64-bit binaries for Linux on Power Systems running in big endian mode in addition to the existing 64-bit binaries for running in little endian mode. PR-URL: #6810
- **buffer**: fix lastIndexOf and indexOf in various edge cases (Anna Henningsen) [#6511](#6511) - **child_process**: use /system/bin/sh on android (Ben Noordhuis) [#6745](#6745) - **deps**: - upgrade npm to 3.8.9 (Rebecca Turner) [#6664](#6664) - upgrade to V8 5.0.71.47 (Ali Ijaz Sheikh) [#6572](#6572) - upgrade libuv to 1.9.1 (Saúl Ibarra Corretgé) [#6796](#6796) - Intl: ICU 57 bump (Steven R. Loomis) [#6088](#6088) - **repl**: - copying tabs shouldn't trigger completion (Eugene Obrezkov) [#5958](#5958) - exports `Recoverable` (Blake Embrey) [#3488](#3488) - **src**: add O_NOATIME constant (Rich Trott) [#6492](#6492) - **src,module**: add --preserve-symlinks command line flag (James M Snell) [#6537](#6537) - **util**: adhere to `noDeprecation` set at runtime (Anna Henningsen) [#6683](#6683) As of this release the 6.X line now includes 64-bit binaries for Linux on Power Systems running in big endian mode in addition to the existing 64-bit binaries for running in little endian mode. PR-URL: #6810
MylesBorins
commented
Jun 2, 2016
@addaleax lts? |
addaleax
commented
Jun 2, 2016
Nope, the behaviour in v4.x is fine already. |
Checklist
Affected core subsystem(s)
process (util?)
Description of change
Until now, the docs stated that
process.noDeprecationcould be set at runtime, but before any modules were loaded. That was not true, becauselib/internal/util.jswas loaded during the process startup process, so setting the flag at runtime was always pointless.Minimal test case:
This patch moves checking
process.noDeprecationto the place where it was actually used./cc @jasnell
CI: https://ci.nodejs.org/job/node-test-commit/3263/