@@ -17,7 +17,7 @@ import {
1717 readProfile ,
1818 writeProfile ,
1919} from '../lib/credentials.js' ;
20- import { loadConfig } from '../lib/config.js' ;
20+ import { loadConfig , normalizeEnvVar } from '../lib/config.js' ;
2121import { emitDeprecationNotice } from '../lib/deprecate.js' ;
2222import type { OutputMode } from '../lib/output.js' ;
2323import { GLOBAL_OPTS_HINT , Output , resolveOutputMode } from '../lib/output.js' ;
@@ -85,7 +85,7 @@ export async function runConfigure(opts: ConfigureOptions, deps: AuthDeps = {}):
8585 // treated as unset. Without this, `''` (e.g. `export TESTSPRITE_API_URL=` in a
8686 // shell profile) is non-nullish and would short-circuit the `??` chains below to
8787 // an empty endpoint instead of falling through to the profile / prod default.
88- const envApiUrl = env . TESTSPRITE_API_URL ?. trim ( ) || undefined ;
88+ const envApiUrl = normalizeEnvVar ( env . TESTSPRITE_API_URL ) ;
8989
9090 // Dry-run: do not prompt, do not read env, do not write credentials.
9191 // Print the canned success shape so an agent sees exactly the JSON it
@@ -208,7 +208,8 @@ export async function runWhoami(opts: CommonOptions, deps: AuthDeps = {}): Promi
208208 // displayed URL always matches where requests actually go (dogfood L1788).
209209 let resolvedEndpoint : string ;
210210 if ( opts . dryRun ) {
211- resolvedEndpoint = opts . endpointUrl ?? env . TESTSPRITE_API_URL ?? 'https://api.testsprite.com' ;
211+ resolvedEndpoint =
212+ opts . endpointUrl ?? normalizeEnvVar ( env . TESTSPRITE_API_URL ) ?? 'https://api.testsprite.com' ;
212213 } else {
213214 const credentialsPath = deps . credentialsPath ?? defaultCredentialsPath ( ) ;
214215 const config = loadConfig ( {
0 commit comments