Skip to content

test_runner: do not read from process.argv and process.cwd() in run() #53867

Open

Description

@mcollina

Currently the codebase for

function run(options = kEmptyObject) {
accesses some poperties of process, capturing some options there. However, we also expose run() to the end users, therefore we should capture all this information in
const options = {
and pass it down to run() as options.

Activity

  1. added
    good first issueIssues that are suitable for first-time contributors.
    test_runnerIssues and PRs related to the test runner subsystem.
    on Jul 16, 2024
  2. changed the title [-]test_runner: do not read from `process.argv` in run()[/-] [+]test_runner: do not read from `process.argv` and `process.cwd()` in run()[/+] on Jul 16, 2024
  3. eliphazbouye commented on Jul 18, 2024

    @eliphazbouye
    Contributor

    @mcollina this issue still relevant or are you already working on it ? I ask it because I see you mentioned it on your last PR !
    If it's still relevant, I'll start working on it :)

  4. mcollina commented on Jul 18, 2024

    @mcollina
    SponsorMemberAuthor

    It's likely best to wait until my PR lands first!

  5. eliphazbouye commented on Jul 18, 2024

    @eliphazbouye
    Contributor

    Okay, I'll wait :)

  6. mcollina commented on Jul 25, 2024

    @mcollina
    SponsorMemberAuthor

    @eliphazb go ahead and make the PR!

  7. eliphazbouye commented on Jul 25, 2024

    @eliphazbouye
    Contributor

    Okay 🚀 I'm going

  8. eliphazbouye commented on Aug 2, 2024

    @eliphazbouye
    Contributor

    @mcollina someone already take it :(

  9. mcollina commented on Aug 12, 2024

    @mcollina
    SponsorMemberAuthor

    @SophonieBouye doesn't look like it to me. There is a lot more to be done here.

  10. 14 remaining items

  11. karankraina commented on Oct 12, 2024

    @karankraina

    @cjihrig Can you please elaborate a little on what is pending in this? I will pick it up.

  12. zhanglinqian commented on Feb 12, 2026

    @zhanglinqian

    I'd like to work on this issue.

  13. murataslan1 commented on Mar 21, 2026

    @murataslan1

    Hey, I'd like to take a stab at this.

    PR #54705 added cwd but there are still a bunch of process reads left in run():

    • getRunArgs() reads process.execArgv and process.argv directly
    • run() falls back to process.env when opts.env isn't provided
    • process.env.NODE_TEST_CONTEXT is checked directly

    Plan is to capture these in the CLI entry point and pass them through as options, keeping backwards compat for public API users.

  14. RounakKumarAgarwal commented on Aug 12, 2026

    @RounakKumarAgarwal

    Hi I would like to work on the issue @mcollina ,can you assign it to me ?

  15. removed
    good first issueIssues that are suitable for first-time contributors.
    on Aug 12, 2026
  16. Mohammad-Ranjbar commented on Sep 1, 2026

    @Mohammad-Ranjbar

    Hi, I'd like to work on this issue.

    I see that there have been previous linked attempts, but GitHub currently shows no active pull request. Before starting, I'd like to confirm that the proposed direction is still current:

    • collect the relevant process.argv / process.cwd()-derived values in lib/internal/main/test_runner.js;
    • pass them explicitly through the run() options;
    • remove the corresponding global-process reads from lib/internal/test_runner/runner.js;
    • update or add focused test-runner tests without changing CLI behavior.

    Is this issue still available, and are there any lessons from the previous PRs that I should account for?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    test_runnerIssues and PRs related to the test runner subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions