Skip to content

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

Merged
zeshi-du merged 1 commit into
TestSprite:mainfrom
0xshalah:fix/profile-blank-env-var
Jul 18, 2026
Merged

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

Conversation

@0xshalah

@0xshalah 0xshalah commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

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.

@zeshi-du zeshi-du left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surgical fix reusing the existing normalizeEnvVar helper already applied to the sibling env vars in the same function, with the three targeted tests. The red gate check is a repo-wide CI infra issue we just fixed on main — unrelated to this PR. Thanks @0xshalah!

@zeshi-du
zeshi-du merged commit 5fe0b00 into TestSprite:main Jul 18, 2026
1 of 2 checks passed
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.

2 participants