Skip to content

Conversation

@geropl
Copy link
Member

@geropl geropl commented Dec 10, 2025

Description

Fixes the ifEnvVarNotSet utility to properly skip tests when environment variables are set to empty strings.

Problem

The test skip mechanism was failing in CI because:

  1. ifEnvVarNotSet only checked for undefined
  2. In CI, Bitbucket token env vars were set to empty strings ("")
  3. Empty string ≠ undefined, so tests ran without valid tokens
  4. Tests failed with 401 authentication errors

Example from CI logs:

GITPOD_TEST_TOKEN_GITHUB: ***          ← Has value (tests pass)
GITPOD_TEST_TOKEN_GITLAB: ***          ← Has value (tests pass)
GITPOD_TEST_TOKEN_BITBUCKET:           ← Empty string (tests fail!)
GITPOD_TEST_TOKEN_BITBUCKET_SERVER:    ← Empty string (tests fail!)

Solution

Updated ifEnvVarNotSet to check for both undefined and empty strings:

const value = process.env[name];
const skip = value === undefined || value === '';

This ensures tests are skipped when tokens are missing or empty, preventing spurious CI failures.

Testing

Verified the logic handles all cases correctly:

  • undefined → skip
  • Empty string → skip
  • Has value → don't skip

Related

Fixes test failures seen in https://github.com/gitpod-io/gitpod/actions/runs/20091345213/job/57639328696

The ifEnvVarNotSet function was only checking for undefined, but in CI
environments variables can be set to empty strings. This caused tests
to run when they should have been skipped, resulting in 401 errors.

Now checks for both undefined and empty string values.

Co-authored-by: Ona <[email protected]>
@geropl geropl force-pushed the fix/skip-if-empty-env-vars branch from 1072dc1 to efae4dd Compare December 11, 2025 13:11
@geropl geropl deployed to branch-build December 11, 2025 13:11 — with GitHub Actions Active
@github-actions
Copy link
Contributor

⚠️ Hey reviewer! BE CAREFUL ⚠️
Review the code before opening in your Gitpod. .gitpod.yml was changed and it might be harmful.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants