Skip to content

test: improve coverage for apphosting yaml configs#10355

Open
joehan wants to merge 1 commit intomainfrom
test/apphosting-yaml
Open

test: improve coverage for apphosting yaml configs#10355
joehan wants to merge 1 commit intomainfrom
test/apphosting-yaml

Conversation

@joehan
Copy link
Copy Markdown
Member

@joehan joehan commented Apr 15, 2026

Description

Implement loading, merging, storing assertions and fix environment map formatting bugs for app hosting setup.

Scenarios Tested

  • Loading basic strings and merging overlapping targets

### Description
Implement loading, merging, storing assertions and fix environment map formatting bugs for app hosting setup.

### Scenarios Tested
- Loading basic strings and merging overlapping targets
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the unit tests for AppHostingYamlConfig, introducing Sinon stubs for file system and utility modules to improve test isolation. It also fixes a bug in the toEnvMap utility where the original environment object was being mutated instead of its clone. Feedback was provided to improve type safety by replacing an 'any' cast with 'Partial' in accordance with the repository style guide.

Comment thread src/apphosting/yaml.ts
const variable = env.variable;
const tmp = { ...env };
delete (env as any).variable;
delete (tmp as any).variable;
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.

medium

The use of any as an escape hatch is discouraged by the repository style guide (Line 38). You can avoid it by casting to Partial<Env>, which allows the deletion of the required variable property while maintaining better type safety than any.

Suggested change
delete (tmp as any).variable;
delete (tmp as Partial<Env>).variable;
References
  1. Never use any or unknown as an escape hatch. Define proper interfaces/types or use type guards. (link)

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