Skip to content

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

Closed
MD-Mushfiqur123 wants to merge 1 commit into
nodejs:mainfrom
MD-Mushfiqur123:fix/run-no-process-globals
Closed

MD-Mushfiqur123 wants to merge 1 commit into
nodejs:mainfrom
MD-Mushfiqur123:fix/run-no-process-globals

Conversation

@MD-Mushfiqur123

Copy link
Copy Markdown

What

Move \process.argv\ and \process.cwd()\ reads out of
un()\ and into \main/test_runner.js, passing them as options instead.

Why

Closes #53867. The
un()\ function is also exposed to end users via the
ode:test\ API, so it should not depend on \process\ globals. All process-level state should be captured at the CLI entry point (\main/test_runner.js) and passed down.

How

\lib/internal/main/test_runner.js:

  • Capture \process.argv\ as \options.argv\
  • Capture \process.cwd()\ as \options.cwd\

\lib/internal/test_runner/runner.js:

  • Replace \process.argv.slice(1)\ with \suppliedArgs\ in \getRunArgs()\
  • Move \suppliedArgs\ push inside both branches to avoid duplication

The \cwd = process.cwd()\ default in
un()\ is preserved for backward compatibility when called programmatically without options.

Testing

  • Existing tests should continue to pass since behavior is identical
  • \main/test_runner.js\ now passes the same values that
    unner.js\ was reading directly
  • CI will verify

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. labels May 20, 2026
Signed-off-by: god032396-del <god032396@gmail.com>
@MD-Mushfiqur123
MD-Mushfiqur123 force-pushed the fix/run-no-process-globals branch from dd377c8 to c8b7b78 Compare June 13, 2026 02:25
@MD-Mushfiqur123
MD-Mushfiqur123 requested a review from a team as a code owner June 13, 2026 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants