FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

test: allow specifying more known globals via ENV by refack · Pull Request #15187 · nodejs/node · GitHub

/ node Public

test: allow specifying more known globals via ENV - #15187

Merged
refack merged 1 commit into
nodejs:masterfrom
refack:test-common-ignore-global-_jb_debug_helper
Sep 13, 2017
Merged

test: allow specifying more known globals via ENV#15187
refack merged 1 commit into
nodejs:masterfrom
refack:test-common-ignore-global-_jb_debug_helper

Conversation

refack commented Sep 4, 2017
edited
Loading

Copy link
Copy Markdown
Contributor

update
In order to provide a smoother test dev experience, with less false positives, we should allow specifying more known global symbols. This implementation uses an ENV var for said specification.

Example

end update

When debugging /test/ using JetBrains' debugger sometimes it leaked a global symbol _jb_debug_helper:

C:\bin\dev\node\node.exe --inspect-brk=58577 D:\code\node\test\parallel\test-setproctitle.js
Debugger listening on ws://127.0.0.1:58577/bd9a5439-00dd-4040-8f4d-a9c8f983834e
For help see https://nodejs.org/en/docs/inspector
Debugger attached.
assert.js:60
  throw new errors.AssertionError({
  ^

AssertionError [ERR_ASSERTION]: Unexpected global(s) found: _jb_debug_helper
    at process.<anonymous> (D:\code\node\test\common\index.js:453:12)
    at emitOne (events.js:120:20)
    at process.emit (events.js:210:7)
Waiting for the debugger to disconnect...

Process finished with exit code 1

A bug report was opened upstream for said IDE
Refs: https://youtrack.jetbrains.com/issue/WEB-27528

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

test

nodejs-github-bot added the test Issues and PRs related to the tests. label Sep 4, 2017
refack self-assigned this Sep 4, 2017
refack changed the title test: allow JetBrain leaked global test: allow JetBrains leaked global Sep 4, 2017
refack force-pushed the test-common-ignore-global-_jb_debug_helper branch from 8c172a9 to d496037 Compare September 4, 2017 15:33
Comment thread test/common/index.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

btw, this change is somewhat unrelated ;)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Yes, I thought for a second I could add it here, but it's not the right place.
Reverted the comma.

refack force-pushed the test-common-ignore-global-_jb_debug_helper branch from d496037 to 6baa612 Compare September 4, 2017 15:36

cjihrig left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I don't think we should make it a habit of adding miscellaneous globals from IDEs.

mscdex commented Sep 4, 2017

Copy link
Copy Markdown
Contributor

I don't understand the need for this for running the test suite. To me, this seems like something JetBrains should fix, not us.

refack commented Sep 4, 2017

Copy link
Copy Markdown
Contributor Author

I don't think we should make it a habit of adding miscellaneous globals from IDEs.

I don't understand the need for this for running the test suite. To me, this seems like something JetBrains should fix, not us.

I added a reference to the Issue I opened for JetBrains, meanwhile it's a nuisance for devs who want to debug the tests with a JetBrains tool.
On some level this could be equated with excluding compiler warnings, or adding a known kruft pattern to .gitignore, i.e. it does not directly relevant to the runtime but has the benefit of making devs' life a little bit easier. 🤷‍♂️

mscdex previously requested changes Sep 4, 2017

mscdex left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Making it explicit

benjamingr left a comment
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think it is a reasonable exception in order to make a dev's life easier and we shouldn't be purist about it -it's helpful and there is no harm.

TimothyGu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Given how unlikely it is to have a legitimate _jb_debug_helper global leaking from our code, I'd say LGTM.

Copy link
Copy Markdown
Member

I'm with Brian and Colin: if your tool of choice is broken, fix it or use a better one, don't add hacks.

Copy link
Copy Markdown
Contributor

I don't think we can guarantee inspectors won't inject things. Perhaps we could have a way to force code tampering off?

mscdex commented Sep 5, 2017

Copy link
Copy Markdown
Contributor

@Fishrock123 If you do that, then you won't know when non-IDE globals start leaking...

Copy link
Copy Markdown
Contributor

It is my understanding that the global leak checks do not use the inspector, (or at the very least they pre-date the inspector)?

jasnell commented Sep 7, 2017

Copy link
Copy Markdown
Member

Another possible alternative solution to just saying no would be to introduce an environment variable that test/common pays attention to, allowing globals like this to be set. There would be zero impact on the default case and CI would not be impacted.

Copy link
Copy Markdown
Member

I won't strenuously object but that's still adding complexity to work around a broken tool.

Copy link
Copy Markdown
Member

What is the conclusion here? We have a couple of persons pro and a couple of persons against it. I personally have no strong opinion about this but I am somewhat with @cjihrig etc that this should be fixed in JetBrains and not in Node.

Copy link
Copy Markdown
Member

Even though I'm in favor of this PR, I think it should be closed given the number of 👎's this is getting. My two cents.

Trott commented Sep 11, 2017
edited
Loading

Copy link
Copy Markdown
Member

Even though I'm in favor of this PR, I think it should be closed given the number of 👎's this is getting. My two cents.

Yeah, if I'm not mistaken, there's only two ways this could land:

  • Convince all the people with objections that it's actually a good idea (or that some similar implementation is a good idea). Seems very unlikely.

  • Escalate to the TSC for a decision.

Copy link
Copy Markdown
Member

I’d leave that decision to @refack. I’m not terribly happy about this patch either, but if @refack says it makes his working on Node easier, then I think that’s worth 6 more lines of code.

refack commented Sep 11, 2017

Copy link
Copy Markdown
Contributor Author

IMHO It's not worth escalating.
I'll switch implementation to an environment variable in place of the hardcoded exception and ask again.

refack commented Sep 11, 2017

Copy link
Copy Markdown
Contributor Author

@mscdex and other objectors PTAL
I switched impl to be a configurable env var:

if (process.env.NODE_TEST_KNOWN_GLOBALS) {
  const knownFromEnv = process.env.NODE_TEST_KNOWN_GLOBALS.split(',');
  allowGlobals(...knownFromEnv);
}

/cc @ulitink @segrey

refack changed the title test: allow JetBrains leaked global test: allow specifying more known globals via ENV Sep 11, 2017

Copy link
Copy Markdown
Member

Still LGTM, but now Node.js is not aware of hard coded debugger values - so that's nice.

cjihrig left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This seems more reasonable to me.

BridgeAR left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This is much cleaner 👍

Copy link
Copy Markdown
Member

@mscdex are you still against this with the current change?

mscdex dismissed their stale review September 13, 2017 18:34

@BridgeAR it's a better solution

mscdex commented Sep 13, 2017

Copy link
Copy Markdown
Contributor

It still shouldn't be necessary though...

refack commented Sep 13, 2017

Copy link
Copy Markdown
Contributor Author

refack force-pushed the test-common-ignore-global-_jb_debug_helper branch from 17e2716 to 21cb0ef Compare September 13, 2017 19:55
PR-URL: nodejs#15187
Refs: https://youtrack.jetbrains.com/issue/WEB-27528
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
refack force-pushed the test-common-ignore-global-_jb_debug_helper branch from 21cb0ef to b8d532c Compare September 13, 2017 21:08
refack merged commit b8d532c into nodejs:master Sep 13, 2017
addaleax pushed a commit to addaleax/ayo that referenced this pull request Sep 17, 2017
PR-URL: nodejs/node#15187
Refs: https://youtrack.jetbrains.com/issue/WEB-27528
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
refack deleted the test-common-ignore-global-_jb_debug_helper branch September 18, 2017 01:01
jasnell pushed a commit that referenced this pull request Sep 20, 2017
PR-URL: #15187
Refs: https://youtrack.jetbrains.com/issue/WEB-27528
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Qard pushed a commit to Qard/ayo that referenced this pull request Sep 21, 2017
PR-URL: nodejs/node#15187
Refs: https://youtrack.jetbrains.com/issue/WEB-27528
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Oct 17, 2017
PR-URL: #15187
Refs: https://youtrack.jetbrains.com/issue/WEB-27528
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins mentioned this pull request Oct 17, 2017
MylesBorins pushed a commit that referenced this pull request Oct 25, 2017
PR-URL: #15187
Refs: https://youtrack.jetbrains.com/issue/WEB-27528
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins mentioned this pull request Nov 3, 2017
refack removed their assignment Oct 12, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test Issues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.


Back | FazBrowse Home | New Git URL