Refactor naming of proxy bootstrapping function

Signed-off-by: enyineer <nico.enking@gmail.com>
This commit is contained in:
enyineer
2025-11-12 15:02:04 +01:00
parent 235c67ae99
commit 84a0dff66f
6 changed files with 17 additions and 17 deletions
+1 -1
View File
@@ -23,4 +23,4 @@
export { findPaths, BACKSTAGE_JSON } from './paths';
export { isChildPath } from './isChildPath';
export type { Paths, ResolveFunc } from './paths';
export { maybeBootstrapProxy } from './proxyBootstrap';
export { bootstrapEnvProxyAgents } from './proxyBootstrap';
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { maybeBootstrapProxy } from './proxyBootstrap';
import { bootstrapEnvProxyAgents } from './proxyBootstrap';
jest.mock('global-agent', () => ({
bootstrap: jest.fn(),
@@ -24,7 +24,7 @@ jest.mock('undici', () => ({
EnvHttpProxyAgent: jest.fn(),
}));
describe('maybeBootstrapProxy', () => {
describe('bootstrapEnvProxyAgents', () => {
const originalEnv = process.env;
beforeEach(() => {
@@ -42,7 +42,7 @@ describe('maybeBootstrapProxy', () => {
const { bootstrap } =
require('global-agent') as typeof import('global-agent');
maybeBootstrapProxy();
bootstrapEnvProxyAgents();
expect(bootstrap).toHaveBeenCalledTimes(1);
});
@@ -52,7 +52,7 @@ describe('maybeBootstrapProxy', () => {
const { bootstrap } =
require('global-agent') as typeof import('global-agent');
maybeBootstrapProxy();
bootstrapEnvProxyAgents();
expect(bootstrap).toHaveBeenCalledTimes(1);
});
@@ -62,7 +62,7 @@ describe('maybeBootstrapProxy', () => {
const { setGlobalDispatcher, EnvHttpProxyAgent } =
require('undici') as typeof import('undici');
maybeBootstrapProxy();
bootstrapEnvProxyAgents();
expect(EnvHttpProxyAgent).toHaveBeenCalledTimes(1);
expect(setGlobalDispatcher).toHaveBeenCalledWith(
@@ -75,7 +75,7 @@ describe('maybeBootstrapProxy', () => {
const { setGlobalDispatcher, EnvHttpProxyAgent } =
require('undici') as typeof import('undici');
maybeBootstrapProxy();
bootstrapEnvProxyAgents();
expect(EnvHttpProxyAgent).toHaveBeenCalledTimes(1);
expect(setGlobalDispatcher).toHaveBeenCalledWith(
@@ -89,7 +89,7 @@ describe('maybeBootstrapProxy', () => {
const { setGlobalDispatcher } =
require('undici') as typeof import('undici');
maybeBootstrapProxy();
bootstrapEnvProxyAgents();
expect(bootstrap).not.toHaveBeenCalled();
expect(setGlobalDispatcher).not.toHaveBeenCalled();
@@ -101,7 +101,7 @@ describe('maybeBootstrapProxy', () => {
const { bootstrap } =
require('global-agent') as typeof import('global-agent');
maybeBootstrapProxy();
bootstrapEnvProxyAgents();
expect(bootstrap).toHaveBeenCalledTimes(1);
});
+1 -1
View File
@@ -28,7 +28,7 @@
*
* @public
*/
export function maybeBootstrapProxy() {
export function bootstrapEnvProxyAgents() {
// see https://www.npmjs.com/package/global-agent
const globalAgentNamespace =
process.env.GLOBAL_AGENT_ENVIRONMENT_VARIABLE_NAMESPACE ?? 'GLOBAL_AGENT_';