Skip to content

Make deploy config path runtime-based for tests#227

Open
Amanlabh wants to merge 1 commit intometacall:masterfrom
Amanlabh:codex/ci-test-env-fixes
Open

Make deploy config path runtime-based for tests#227
Amanlabh wants to merge 1 commit intometacall:masterfrom
Amanlabh:codex/ci-test-env-fixes

Conversation

@Amanlabh
Copy link

Summary\n- compute default config path at runtime (so HOME overrides work in tests)\n- update startup to use runtime default path\n- adjust integration tests to use temp HOME and skip auth-only tests when creds are missing\n\n## Testing\n- npm test -- --reporter dot (fails only in auth-required integration tests without creds)

Copilot AI review requested due to automatic review settings March 19, 2026 10:28
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the CLI configuration default-path handling so it’s computed at runtime (allowing tests to override HOME reliably), and adjusts integration tests to run in an isolated temp “home” and to skip auth-dependent cases when credentials aren’t provided.

Changes:

  • Replace import-time defaultPath usage with a runtime getDefaultPath() in config loading/startup flows.
  • Update CLI test harness to pass HOME to spawned CLI processes from the current runtime env.
  • Adjust integration tests to set HOME to a temporary directory and skip credential-dependent tests when creds are missing.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/config.ts Introduces getDefaultPath() and uses it as the default for config path resolution at call time.
src/startup.ts Switches startup to load config using runtime default path via getDefaultPath().
src/test/cli.ts Ensures spawned CLI processes receive HOME from the current process env (or os.homedir() fallback) and changes checkEnvVars to return null instead of failing.
src/test/cli.integration.spec.ts Sets a temp HOME for deploy integration tests and skips the email/password login test when creds aren’t present.
src/test/login.cli.integration.spec.ts Sets temp HOME for login integration tests and skips the suite when creds aren’t present.

Comment on lines 19 to +23
before(async function () {
await clearCache();
checkEnvVars();
process.env.HOME = await createTmpDirectory();
if (!checkEnvVars()) {
this.skip();
Comment on lines 20 to +24
await clearCache();
checkEnvVars();
process.env.HOME = await createTmpDirectory();
if (!checkEnvVars()) {
this.skip();
}
Comment on lines 16 to 20
this.timeout(2000000);
before(async function () {
process.env.HOME = await createTmpDirectory();
});

Comment on lines 35 to +41
it('Should be able to login using --email & --password flag', async function () {
await clearCache();
const { email, password } = checkEnvVars();
const creds = checkEnvVars();
if (!creds) {
this.skip();
}
const { email, password } = creds;
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