-
- Notifications
You must be signed in to change notification settings - Fork 33.7k
test_runner: remove problematic uses of parseCommandLine() #54353
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
Closed
Conversation
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
This commit updates parseCommandLine() to use the names supported by run(). This removes some unnecessary renaming code, and allows node:test and run() to more easily share code.
This commit initializes the root harness object before the root test and passes the harness as an option to the root test constructor. This commit also attaches the global configuration to the harness. This will allow the parseCommandLine() call in test.js to be removed, as those values are now available via the root test.
The global configuration should already be known when createTestTree() is called. This commit updates that function to take the global configuration as an input.
Now that parseCommandLine() returns run() compatible arguments, it makes sense to return setupTestReporters() as the setup() argument to run(). This also removes another problematic use of parseCommandLine() in setupTestReporters().
This commit makes hook creation more consistent by always passing in a reference to the test that owns the hook. It also removes some unnecessary validation on internal API.
The lib/internal/test_runner/test.js should not use the parseCommandLine() function. This commit refactors the code to avoid doing so.
Collaborator
| Review requested:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@ ## main #54353 +/- ## ========================================== + Coverage 87.09% 87.10% +0.01% ========================================== Files 648 648 Lines 182213 182244 +31 Branches 34961 34958 -3 ========================================== + Hits 158703 158751 +48 + Misses 16794 16784 -10 + Partials 6716 6709 -7
|
benjamingr approved these changes Aug 13, 2024
Collaborator
mcollina approved these changes Aug 14, 2024
Member
mcollina left a comment
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.
lgtm
Collaborator
| Landed in e020dd8...48d63c4 |
nodejs-github-bot pushed a commit that referenced this pull request Aug 15, 2024
This commit updates parseCommandLine() to use the names supported by run(). This removes some unnecessary renaming code, and allows node:test and run() to more easily share code. PR-URL: #54353 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
nodejs-github-bot pushed a commit that referenced this pull request Aug 15, 2024
This commit initializes the root harness object before the root test and passes the harness as an option to the root test constructor. This commit also attaches the global configuration to the harness. This will allow the parseCommandLine() call in test.js to be removed, as those values are now available via the root test. PR-URL: #54353 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
nodejs-github-bot pushed a commit that referenced this pull request Aug 15, 2024
The global configuration should already be known when createTestTree() is called. This commit updates that function to take the global configuration as an input. PR-URL: #54353 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
nodejs-github-bot pushed a commit that referenced this pull request Aug 15, 2024
Now that parseCommandLine() returns run() compatible arguments, it makes sense to return setupTestReporters() as the setup() argument to run(). This also removes another problematic use of parseCommandLine() in setupTestReporters(). PR-URL: #54353 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
nodejs-github-bot pushed a commit that referenced this pull request Aug 15, 2024
This commit makes hook creation more consistent by always passing in a reference to the test that owns the hook. It also removes some unnecessary validation on internal API. PR-URL: #54353 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
nodejs-github-bot pushed a commit that referenced this pull request Aug 15, 2024
The lib/internal/test_runner/test.js should not use the parseCommandLine() function. This commit refactors the code to avoid doing so. PR-URL: #54353 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Member
| Nice 👍🏻 thanks for the effort |
RafaelGSS pushed a commit that referenced this pull request Aug 19, 2024
This commit updates parseCommandLine() to use the names supported by run(). This removes some unnecessary renaming code, and allows node:test and run() to more easily share code. PR-URL: #54353 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
RafaelGSS pushed a commit that referenced this pull request Aug 19, 2024
This commit initializes the root harness object before the root test and passes the harness as an option to the root test constructor. This commit also attaches the global configuration to the harness. This will allow the parseCommandLine() call in test.js to be removed, as those values are now available via the root test. PR-URL: #54353 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
RafaelGSS pushed a commit that referenced this pull request Aug 19, 2024
The global configuration should already be known when createTestTree() is called. This commit updates that function to take the global configuration as an input. PR-URL: #54353 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
RafaelGSS pushed a commit that referenced this pull request Aug 19, 2024
Now that parseCommandLine() returns run() compatible arguments, it makes sense to return setupTestReporters() as the setup() argument to run(). This also removes another problematic use of parseCommandLine() in setupTestReporters(). PR-URL: #54353 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
RafaelGSS pushed a commit that referenced this pull request Aug 19, 2024
This commit makes hook creation more consistent by always passing in a reference to the test that owns the hook. It also removes some unnecessary validation on internal API. PR-URL: #54353 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
RafaelGSS pushed a commit that referenced this pull request Aug 19, 2024
The lib/internal/test_runner/test.js should not use the parseCommandLine() function. This commit refactors the code to avoid doing so. PR-URL: #54353 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Merged
RafaelGSS pushed a commit that referenced this pull request Aug 21, 2024
This commit updates parseCommandLine() to use the names supported by run(). This removes some unnecessary renaming code, and allows node:test and run() to more easily share code. PR-URL: #54353 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
RafaelGSS pushed a commit that referenced this pull request Aug 21, 2024
This commit initializes the root harness object before the root test and passes the harness as an option to the root test constructor. This commit also attaches the global configuration to the harness. This will allow the parseCommandLine() call in test.js to be removed, as those values are now available via the root test. PR-URL: #54353 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
RafaelGSS pushed a commit that referenced this pull request Aug 21, 2024
The global configuration should already be known when createTestTree() is called. This commit updates that function to take the global configuration as an input. PR-URL: #54353 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
RafaelGSS pushed a commit that referenced this pull request Aug 21, 2024
Now that parseCommandLine() returns run() compatible arguments, it makes sense to return setupTestReporters() as the setup() argument to run(). This also removes another problematic use of parseCommandLine() in setupTestReporters(). PR-URL: #54353 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
RafaelGSS pushed a commit that referenced this pull request Aug 21, 2024
This commit makes hook creation more consistent by always passing in a reference to the test that owns the hook. It also removes some unnecessary validation on internal API. PR-URL: #54353 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
RafaelGSS pushed a commit that referenced this pull request Aug 21, 2024
The lib/internal/test_runner/test.js should not use the parseCommandLine() function. This commit refactors the code to avoid doing so. PR-URL: #54353 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. lib / src Issues and PRs related to general changes in the lib or src directory. test_runner Issues and PRs related to the test runner subsystem.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
This PR removes uses of
parseCommandLine()throughout the test runner. This work is related to #53867, as it reduces the use of process global state in the test runner where it should not be used.test_runner: use
run()argument names inparseCommandLine()This commit updates
parseCommandLine()to use the names supportedby
run(). This removes some unnecessary renaming code, and allowsnode:testandrun()to more easily share code.test_runner: pass harness object as option to root test
This commit initializes the root harness object before the root
test and passes the harness as an option to the root test
constructor. This commit also attaches the global configuration
to the harness. This will allow the
parseCommandLine()call intest.jsto be removed, as those values are now available viathe root test.
test_runner: pass global options to
createTestTree()The global configuration should already be known when
createTestTree()is called. This commit updates that functionto take the global configuration as an input.
test_runner: return
setup()fromparseCommandLine()Now that
parseCommandLine()returnsrun()compatible arguments,it makes sense to return
setupTestReporters()as thesetup()argument to
run(). This also removes another problematic use ofparseCommandLine()insetupTestReporters().test_runner: refactor hook creation
This commit makes hook creation more consistent by always
passing in a reference to the test that owns the hook. It also
removes some unnecessary validation on internal API.
test_runner: remove
parseCommandLine()fromtest.jsThe
lib/internal/test_runner/test.jsfile should not use theparseCommandLine()function. This commit refactors the code toavoid doing so.