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 issue
    test_runner
    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. soophoo commented on Jul 18, 2024

    @soophoo
    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. soophoo commented on Jul 18, 2024

    @soophoo
    Contributor

    Okay, I'll wait :)

  6. mcollina commented on Jul 25, 2024

    @mcollina
    SponsorMemberAuthor

    @eliphazb go ahead and make the PR!

  7. soophoo commented on Jul 25, 2024

    @soophoo
    Contributor

    Okay 🚀 I'm going

  8. soophoo commented on Aug 2, 2024

    @soophoo
    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. 16 remaining items

  11. zhanglinqian commented on Feb 12, 2026

    @zhanglinqian

    I'd like to work on this issue.

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

  13. RounakKumarAgarwal commented on Aug 12, 2026

    @RounakKumarAgarwal

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

  14. removed
    good first issue
    on Aug 12, 2026
  15. 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?

  16. github-actions commented on Dec 1, 2026

    @github-actions
    Contributor

    This issue has been marked as stale due to 90 days of inactivity.
    It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.

  17. added
    stale
    on Dec 1, 2026
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

    staletest_runner

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions