cli: add --use-env-proxy

This does the same as NODE_USE_ENV_PROXY. When both are set,
like other options that can be configured from both sides,
the CLI flag takes precedence.

PR-URL: https://github.com/nodejs/node/pull/59151
Fixes: https://github.com/nodejs/node/issues/59100
Reviewed-By: Ilyas Shabi <ilyasshabi94@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
Joyee Cheung authored and Antoine du Hamel committed 2025-10-18 20:35:56 +02:00
1 parent 42102594b1
commit 1486fedea1
16 files changed
+347 -30

No files matched your search

+4 -4
View File
@@ -142,11 +142,11 @@ function spawnPromisified(...args) {
});
}
exports.checkProxiedFetch = async function(envExtension, expectation) {
exports.checkProxiedFetch = async function(envExtension, expectation, cliArgsExtension = []) {
const fixtures = require('./fixtures');
const { code, signal, stdout, stderr } = await spawnPromisified(
process.execPath,
['--no-warnings', fixtures.path('fetch-and-log.mjs')], {
['--no-warnings', ...cliArgsExtension, fixtures.path('fetch-and-log.mjs')], {
env: {
...process.env,
...envExtension,
@@ -166,11 +166,11 @@ exports.checkProxiedFetch = async function(envExtension, expectation) {
});
};
exports.runProxiedRequest = async function(envExtension) {
exports.runProxiedRequest = async function(envExtension, cliArgsExtension = []) {
const fixtures = require('./fixtures');
return spawnPromisified(
process.execPath,
['--no-warnings', fixtures.path('request-and-log.js')], {
['--no-warnings', ...cliArgsExtension, fixtures.path('request-and-log.js')], {
env: {
...process.env,
...envExtension,