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: make import common as the first line #7786

Closed
wants to merge 1 commit into from

Conversation

thefourtheye
Copy link
Contributor

@thefourtheye thefourtheye commented Jul 18, 2016

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

test

Description of change

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.


cc @nodejs/testing

@thefourtheye thefourtheye added the test Issues and PRs related to the tests. label Jul 18, 2016
@thefourtheye
Copy link
Contributor Author

@targos
Copy link
Member

targos commented Jul 18, 2016

We will need a custom ESLint rule if we want to enforce this.

@@ -1,10 +1,10 @@
'use strict';
var common = require('../common');
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@thefourtheye thefourtheye force-pushed the import-common-first branch 3 times, most recently from 6e7cad9 to 6219a7a Compare July 18, 2016 21:52
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.
@thefourtheye thefourtheye force-pushed the import-common-first branch from 6219a7a to 659160a Compare July 18, 2016 21:55
@thefourtheye
Copy link
Contributor Author

@targos True. I'll give it a shot, in the morning.

@Trott
Copy link
Member

Trott commented Jul 18, 2016

@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.

@cjihrig
Copy link
Contributor

cjihrig commented Jul 19, 2016

LGTM. I think enforcing this via ESLint is a good idea, but it can be done in a different PR.

@jasnell
Copy link
Member

jasnell commented Jul 20, 2016

LGTM

@Trott
Copy link
Member

Trott commented Jul 21, 2016

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.)

Trott pushed a commit to Trott/io.js that referenced this pull request Jul 22, 2016
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>
@Trott
Copy link
Member

Trott commented Jul 22, 2016

Landed in 6123075

@Trott Trott closed this Jul 22, 2016
Trott added a commit to Trott/io.js that referenced this pull request Jul 22, 2016
@thefourtheye thefourtheye deleted the import-common-first branch July 22, 2016 02:58
@thefourtheye
Copy link
Contributor Author

Thanks for landing @Trott :)

evanlucas pushed a commit that referenced this pull request Aug 2, 2016
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>
@cjihrig cjihrig mentioned this pull request Aug 11, 2016
@richardlau richardlau mentioned this pull request Nov 9, 2016
3 tasks
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.

6 participants