-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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: make import common as the first line #7786
Conversation
We will need a custom ESLint rule if we want to enforce this. |
@@ -1,10 +1,10 @@ | |||
'use strict'; | |||
var common = require('../common'); |
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.
In cases like this, where you're moving the require('../common')
, it might make sense to also move to const
.
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.
Done!
6e7cad9
to
6219a7a
Compare
The `test/common` module has the capability to identify if any variable is leaked to the global scope and fail the test. So that has to be imported at the beginning.
6219a7a
to
659160a
Compare
@targos True. I'll give it a shot, in the morning. |
@thefourtheye If you want to do it, probably the way to go is to add a configuration option to the current custom rule such that you can insist that the required modules are loaded before any other modules. |
LGTM. I think enforcing this via ESLint is a good idea, but it can be done in a different PR. |
LGTM |
LGTM @targos @thefourtheye I've got a modification to the existing custom lint rule ready to go to enforce this once this PR lands. Which it looks like this can land. (Been open for three days, CI is green, three LGTMs.) |
The `test/common` module has the capability to identify if any variable is leaked to the global scope and fail the test. So that has to be imported at the beginning. PR-URL: nodejs#7786 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Landed in 6123075 |
Thanks for landing @Trott :) |
The `test/common` module has the capability to identify if any variable is leaked to the global scope and fail the test. So that has to be imported at the beginning. PR-URL: #7786 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Checklist
make -j4 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
test
Description of change
The
test/common
module has the capability to identify if any variableis leaked to the global scope and fail the test. So that has to be
imported at the beginning.
cc @nodejs/testing