Skip to content

fix: resolve TypeScript type errors in update-check.test.ts#3284

Merged
louisgv merged 1 commit intomainfrom
fix/update-check-type-errors
Apr 13, 2026
Merged

fix: resolve TypeScript type errors in update-check.test.ts#3284
louisgv merged 1 commit intomainfrom
fix/update-check-type-errors

Conversation

@la14-1
Copy link
Copy Markdown
Member

@la14-1 la14-1 commented Apr 12, 2026

Why: Eliminates 13 TypeScript type errors in update-check.test.ts caused by mock type mismatches, improving type safety for future refactors.

Changes

  • Replace mock() + spyOn().mockImplementation(mockFn) with direct spyOn().mockImplementation(() => ...) to fix typeof fetch mismatch (missing preconnect property)
  • Make execFileSync mock implementations return Buffer.from("") instead of void to match the expected return type
  • Add explicit type annotations for callback parameters to fix implicit any errors
  • Use typed execFileSyncCalls array with options field to fix possibly-undefined property access
  • Remove unused mock import from bun:test
  • Bump CLI version to 1.0.5

Test plan

  • All 2043 tests pass (bun test)
  • Biome check passes with zero errors
  • update-check.test.ts: 16/16 tests pass

-- refactor/code-health

Replace `mock()` + `spyOn().mockImplementation(mockFn)` pattern with
direct `spyOn().mockImplementation(() => ...)` to fix fetch mock type
mismatches. Make execFileSync mocks return Buffer.from("") instead of
void. Add explicit type annotations for callback parameters.

Agent: code-health
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@louisgv louisgv left a comment

Choose a reason for hiding this comment

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

Security Review

Verdict: APPROVED
Commit: 2df33af

Findings

No security issues found. Changes consist of:

  • Removed unused mock imports (cleanup)
  • Fixed TypeScript type errors by providing proper return types for mock implementations
  • Added explicit Buffer.from("") returns for execFileSync mocks (required by function signature)
  • Added explicit type annotations for callback parameters (e.g., call: unknown[], a: string)
  • No security-sensitive code modified

Tests

  • bun test: PASS (16/16 tests passing)
  • biome check: PASS (0 errors)
  • curl|bash: N/A (test file only)
  • macOS compat: N/A (test file only)

Review Notes

  • All changes are confined to test mocks and type annotations
  • No production code modified
  • Tests verify the changes work correctly
  • Version bump from 1.0.4 → 1.0.5 follows CLI version management rules

-- security/pr-reviewer

@louisgv louisgv added the security-approved Security review approved label Apr 13, 2026
@louisgv louisgv merged commit 439e5a1 into main Apr 13, 2026
6 checks passed
@louisgv louisgv deleted the fix/update-check-type-errors branch April 13, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security-approved Security review approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants