-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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: simplify knownGlobals logic #20677
Conversation
CI failure seemed unrelated. One more try: https://ci.nodejs.org/job/node-test-pull-request/14838/ |
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.
After looking into the globals closer I am -1 on this.
These values are actually never tested for because these properties are all non-enumerable and for...in
does not list does properties.
Instead, I recommend to remove the known globals check. It never worked properly so far and we never had an issue with globals as far as I can tell.
It is just a minor overhead in each test and a maintenance burden.
I think the question of whether or not we should do global checking is outside the scope of this issue. This is a small cleanup of the existing code. Would you please unblock this PR, and open an issue for further discussion. |
@cjihrig having these values in the known globals means they will be excluded from testing even though that should not be the case. So they should actually be removed. I opened #20717 because I looked a bit closer at the knownGlobals. I agree that it is out of scope if the mechanism as such should be removed but just moving them around does not improve anything. If you would like to keep this PR I suggest to just remove the values and I update my PR accodingly. |
I think I misunderstood your original statement. I see what you mean now about the enumerability of those keys. I think we should go one of two ways:
Thoughts from @nodejs/testing and others? |
I'd prefer more thorough tests even at the expense of making them a hair slower, so I'm in favor of option 2, but I'm good with option 1 as well, as it isn't worse than what we have now, IIUC. |
I'm fine with either direction. We could just use FWIW we also test not just for leaked globals but whether the globals have been accidentally replaced with an unexpected value. |
My take on it is to first remove the non-enumerable entries from known globals and to also remove the flag to skip the test as I did in #20717. I definitely think if we test for globals one way or the other, we should also test for the non-enumerable ones, so we should use |
Couldn't that be taken as a sign that the check was doing its job? (I've certainly had it fire on me a few times when I do some funky stuff locally while debugging.) |
To clarify: Maybe no one has ever tried to erroneously add a global in a PR because when they run such a test locally, it fails because of this check we're talking about right now. |
Where are we at on this one? |
I'm working to update the global check to include all properties, including symbols. There are some edge cases, like NaN, but I haven't forgotten about this. |
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes