Skip to content

fix(config): normalize empty/whitespace TESTSPRITE_PROFILE to unset#233

Open
0xshalah wants to merge 1 commit into
TestSprite:mainfrom
0xshalah:fix/profile-blank-env-var
Open

fix(config): normalize empty/whitespace TESTSPRITE_PROFILE to unset#233
0xshalah wants to merge 1 commit into
TestSprite:mainfrom
0xshalah:fix/profile-blank-env-var

Conversation

@0xshalah

@0xshalah 0xshalah commented Jul 10, 2026

Copy link
Copy Markdown

One-line fix: wraps env.TESTSPRITE_PROFILE with normalizeEnvVar() so an
empty/whitespace-only value is treated as unset and resolves to the "default"
profile — consistent with TESTSPRITE_API_URL and TESTSPRITE_API_KEY.

3 new unit tests added (empty, whitespace-only, blank-with-credentials).
eslint + prettier + tsc all clean locally.

Summary by CodeRabbit

  • Bug Fixes

    • Improved configuration loading when the profile environment setting is empty or contains only whitespace.
    • Automatically falls back to the default profile in these cases, including its configured credentials.
  • Tests

    • Added coverage for empty, whitespace-only, and default profile configuration scenarios.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

loadConfig now trims TESTSPRITE_PROFILE before resolving the active profile, treating empty and whitespace-only values as unset. Unit tests cover fallback to the default profile and credential loading from that profile.

Changes

Configuration profile normalization

Layer / File(s) Summary
Profile resolution and fallback tests
src/lib/config.ts, src/lib/config.test.ts
loadConfig normalizes TESTSPRITE_PROFILE before applying the default fallback, with tests for empty, whitespace-only, and default-profile credential behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers: zeshi-du, ruili-testsprite

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes implement #231 by normalizing TESTSPRITE_PROFILE and adding the requested fallback tests.
Out of Scope Changes check ✅ Passed All changes are directly related to the config fix and its tests; no unrelated edits are shown.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: treating empty or whitespace TESTSPRITE_PROFILE values as unset.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant