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: remove common.leakedGlobals() #22965

Closed
wants to merge 1 commit into from
Closed

Conversation

Trott
Copy link
Member

@Trott Trott commented Sep 19, 2018

common.leakedGlobals() was exposed only to test its logic. The logic can
instead be tested by running a fixture file that leaks a global and
seeing if common causes an AssertionError on exit. This way, the
entire functionality of leak detection is tested rather than just the
leakedGlobals() function. It also reduces API surface area for the
common monolith by one function.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Sep 19, 2018
@Trott
Copy link
Member Author

Trott commented Sep 19, 2018

@Trott
Copy link
Member Author

Trott commented Sep 19, 2018

@nodejs/testing

Copy link
Member

@richardlau richardlau left a comment

Choose a reason for hiding this comment

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

Was going to question the use of process.argv[0] instead of process.execPath and naming the first parameter of the callback ex instead of error/err, but see they are consistent with other uses in the same test file.

@richardlau
Copy link
Member

Small nit: Possibly reword the commit title to something like test: do not export common.leakedGlobals()? It's still there and used by test/common/index.js (and is the main reason we require all tests to require the common module).

common.leakedGlobals() was exposed only to test its logic. The logic can
instead be tested by running a fixture file that leaks a global and
seeing if `common` causes an AssertionError on exit. This way, the
entire functionality of leak detection is tested rather than just the
leakedGlobals() function. It also reduces API surface area for the
common monolith by one function.
@Trott
Copy link
Member Author

Trott commented Sep 20, 2018

Updated the commit message. New CI: https://ci.nodejs.org/job/node-test-pull-request/17333/

@Trott
Copy link
Member Author

Trott commented Sep 22, 2018

Landed in 2b29df7

@Trott Trott closed this Sep 22, 2018
Trott added a commit to Trott/io.js that referenced this pull request Sep 22, 2018
common.leakedGlobals() was exposed only to test its logic. The logic can
instead be tested by running a fixture file that leaks a global and
seeing if `common` causes an AssertionError on exit. This way, the
entire functionality of leak detection is tested rather than just the
leakedGlobals() function. It also reduces API surface area for the
common monolith by one function.

PR-URL: nodejs#22965
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Sep 23, 2018
common.leakedGlobals() was exposed only to test its logic. The logic can
instead be tested by running a fixture file that leaks a global and
seeing if `common` causes an AssertionError on exit. This way, the
entire functionality of leak detection is tested rather than just the
leakedGlobals() function. It also reduces API surface area for the
common monolith by one function.

PR-URL: #22965
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@Trott Trott deleted the leakedGlobals branch January 13, 2022 22:50
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.

7 participants