Skip to content

[Hackathon] Normalize empty/whitespace TESTSPRITE_PROFILE env var to fall back to the default profile #232

Description

@0xshalah

Discord Username / User ID: shalahuddin02

What does this improvement do?:
loadConfig() normalizes empty/whitespace-only TESTSPRITE_API_URL and
TESTSPRITE_API_KEY via normalizeEnvVar() so a blank env var is treated as
unset and falls through the ?? chain. TESTSPRITE_PROFILE was missed.

A blank TESTSPRITE_PROFILE= in a shell profile currently breaks every command
with a confusing VALIDATION_ERROR because the empty string fails the INI
section-name guard. This fix applies the same normalization so a blank profile
env var resolves to "default" — consistent with the other two env vars.
Details / implementation notes:
Fix: one-line change in src/lib/config.ts — wraps env.TESTSPRITE_PROFILE with
normalizeEnvVar(), matching the existing pattern for TESTSPRITE_API_URL and
TESTSPRITE_API_KEY.

Added 3 unit tests in src/lib/config.test.ts:

  • empty TESTSPRITE_PROFILE → default
  • whitespace-only TESTSPRITE_PROFILE → default
  • blank TESTSPRITE_PROFILE reads credentials from the default profile

Local verification: eslint clean, prettier clean, tsc --noEmit clean,
14/14 config tests passing, no regressions in full suite.

PR will follow once this issue is triaged and assigned.

  • ☑ I have searched existing issues and this is not a duplicate.
  • ☑ I have provided my Discord identity above for reward coordination.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions