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,console: add testing for monkeypatching of console stdio #26561

Closed
wants to merge 1 commit into from

Conversation

@Trott
Copy link
Member

commented Mar 10, 2019

lib/internal/console/constructor.js contains setters for console._stdout
and console._stderr but these setters are not used in our tests or in
Node.js core. (This is confirmed by our nightly coverage reports.)

Add a test to check monkeypatching _stdout and _stderr on a console
object.

Version 2.6.9 of the very-popular npm module debug used this
monkeypatching in its code. No other version did and they are now at
version 4.something. It is not inconceivable that we would want to
change the setters to throw rather than work. Given that this has seen
use in the ecosystem, I'm inclined to leave the functionality in place.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
test,console: add testing for monkeypatching of console stdio
lib/internal/console/constructor.js contains setters for console._stdout
and console._stderr but these setters are not used in our tests or in
Node.js core. (This is confirmed by our nightly coverage reports.)

Add a test to check monkeypatching _stdout and _stderr on a console
object.

Version 2.6.9 of the very-popular npm module `debug` used this
monkeypatching in its code. No other version did and they are now at
version 4.something. It is not inconceivable that we would want to
change the setters to throw rather than work. Given that this has seen
use in the ecosystem, I'm inclined to leave the functionality in place.
@Trott

This comment has been minimized.

Copy link
Member Author

commented Mar 10, 2019

@BridgeAR

This comment has been minimized.

Copy link
Member

commented Mar 10, 2019

The part where debug uses it seems to be a internal debugging functionality? Since it was added in the release commit I expect it to be added by accident by using e.g. git commit add ..

A user of debug v2.6.9 would not trigger this part.

I would therefore go ahead and deprecate or remove the setter (the latter only with a clean CITGM run and no entries with https://github.com/nodejs/Gzemnid).

@Trott

This comment has been minimized.

Copy link
Member Author

commented Mar 10, 2019

The part where debug uses it seems to be a internal debugging functionality?

That might still be an argument for keeping it. Someone, at one point, found monkey-patching it useful.

My opinion on this isn't a strong one, though, and I'd be fine with checking Gzemnid, changing the setter so that it throws, and running CITGM as an alternative. I worry that would stall, though, so I'd prefer to leave this open (and even land it) while that other process proceeds.

@Trott Trott added the author ready label Mar 12, 2019

Trott added a commit to Trott/io.js that referenced this pull request Mar 17, 2019
test,console: add testing for monkeypatching of console stdio
lib/internal/console/constructor.js contains setters for console._stdout
and console._stderr but these setters are not used in our tests or in
Node.js core. (This is confirmed by our nightly coverage reports.)

Add a test to check monkeypatching _stdout and _stderr on a console
object.

PR-URL: nodejs#26561
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@Trott

This comment has been minimized.

Copy link
Member Author

commented Mar 17, 2019

Landed in 6913bd1 so we have a test for the setters. Will open a semver-major to change this behavior and we'll see how that goes.

@Trott Trott closed this Mar 17, 2019

@Trott

This comment has been minimized.

Copy link
Member Author

commented Mar 17, 2019

Will open a semver-major to change this behavior and we'll see how that goes.

Actually, I think I'm not going to do that. We don't seem to prevent this sort of thing generally and there's no existing error code that I can find that seems to fit, suggesting we may not really do this at all? I'm not opposed to doing it, but it seems like a potentially significant departure and I'm inclined to leave well-enough alone.

Drieger added a commit to Drieger/node that referenced this pull request Mar 22, 2019
test,console: add testing for monkeypatching of console stdio
lib/internal/console/constructor.js contains setters for console._stdout
and console._stderr but these setters are not used in our tests or in
Node.js core. (This is confirmed by our nightly coverage reports.)

Add a test to check monkeypatching _stdout and _stderr on a console
object.

PR-URL: nodejs#26561
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
targos added a commit to targos/node that referenced this pull request Mar 27, 2019
test,console: add testing for monkeypatching of console stdio
lib/internal/console/constructor.js contains setters for console._stdout
and console._stderr but these setters are not used in our tests or in
Node.js core. (This is confirmed by our nightly coverage reports.)

Add a test to check monkeypatching _stdout and _stderr on a console
object.

PR-URL: nodejs#26561
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
targos added a commit to targos/node that referenced this pull request Mar 27, 2019
test,console: add testing for monkeypatching of console stdio
lib/internal/console/constructor.js contains setters for console._stdout
and console._stderr but these setters are not used in our tests or in
Node.js core. (This is confirmed by our nightly coverage reports.)

Add a test to check monkeypatching _stdout and _stderr on a console
object.

PR-URL: nodejs#26561
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
targos added a commit to targos/node that referenced this pull request Mar 27, 2019
test,console: add testing for monkeypatching of console stdio
lib/internal/console/constructor.js contains setters for console._stdout
and console._stderr but these setters are not used in our tests or in
Node.js core. (This is confirmed by our nightly coverage reports.)

Add a test to check monkeypatching _stdout and _stderr on a console
object.

PR-URL: nodejs#26561
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
targos added a commit that referenced this pull request Mar 27, 2019
test,console: add testing for monkeypatching of console stdio
lib/internal/console/constructor.js contains setters for console._stdout
and console._stderr but these setters are not used in our tests or in
Node.js core. (This is confirmed by our nightly coverage reports.)

Add a test to check monkeypatching _stdout and _stderr on a console
object.

PR-URL: #26561
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@targos targos referenced this pull request Mar 27, 2019
BethGriggs added a commit that referenced this pull request Apr 17, 2019
test,console: add testing for monkeypatching of console stdio
lib/internal/console/constructor.js contains setters for console._stdout
and console._stderr but these setters are not used in our tests or in
Node.js core. (This is confirmed by our nightly coverage reports.)

Add a test to check monkeypatching _stdout and _stderr on a console
object.

PR-URL: #26561
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@BethGriggs BethGriggs referenced this pull request May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.