Skip to content

test_runner: capture process properties in main and pass down#61893

Closed
realMelTuc wants to merge 2 commits intonodejs:mainfrom
realMelTuc:fix/test-runner-process-access
Closed

test_runner: capture process properties in main and pass down#61893
realMelTuc wants to merge 2 commits intonodejs:mainfrom
realMelTuc:fix/test-runner-process-access

Conversation

@realMelTuc
Copy link
Copy Markdown

Description

Previously, the test runner accessed process.argv and process.cwd() directly in runner.js. This change captures these values in test_runner.js (the entry point) and passes them through the options object to runner.js.

This addresses issue #53867 by ensuring that the test runner captures all necessary information at the entry point rather than reading from process properties directly in the internal implementation.

Changes Made

  1. lib/internal/main/test_runner.js: Added options.cwd = process.cwd(); to capture the cwd at startup
  2. lib/internal/test_runner/runner.js:
    • Changed cwd = process.cwd() to just cwd in the options destructuring (with fallback for backward compatibility)
    • Changed ArrayPrototypeSlice(process.argv, 1) to suppliedArgs in the isolated process path

Testing

The changes maintain backward compatibility by falling back to process.cwd() if cwd is not provided in the options.

Fixes: #53867

Previously, the test runner accessed process.argv and process.cwd()
directly in runner.js. This change captures these values in
test_runner.js (the entry point) and passes them through the options
object to runner.js.

Fixes: #53867
@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 Feb 19, 2026
- Change 'seperately' to 'separately'
- Change 'paramater' to 'parameter'

These are documentation fixes in the changelog files.
@realMelTuc realMelTuc closed this by deleting the head repository Apr 5, 2026
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