Skip to content

test(backends): add unit coverage for nativeToolRuntime shims#1052

Merged
aaight merged 1 commit intodevfrom
feature/nativeToolRuntime-unit-tests
Mar 25, 2026
Merged

test(backends): add unit coverage for nativeToolRuntime shims#1052
aaight merged 1 commit intodevfrom
feature/nativeToolRuntime-unit-tests

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Mar 25, 2026

Summary

  • Adds tests/unit/backends/nativeToolRuntime.test.ts with 15 unit tests covering createNativeToolRuntimeArtifacts and buildNativeToolPath
  • Verifies shim directory creation, gh shim file existence, executable permissions, and best-effort cleanup
  • Verifies PATH construction: shim-first ordering, CLI tools inclusion, base PATH preservation, and filtering of empty/undefined entries

Test plan

  • createNativeToolRuntimeArtifacts — shim dir created on disk
  • createNativeToolRuntimeArtifactsgh shim file exists
  • createNativeToolRuntimeArtifactsgh shim contains correct shell script content
  • createNativeToolRuntimeArtifactsgh shim has executable permissions (0o755)
  • createNativeToolRuntimeArtifacts — cleanup removes shim directory
  • createNativeToolRuntimeArtifacts — double-cleanup does not throw (best-effort)
  • createNativeToolRuntimeArtifacts — two consecutive calls produce unique directories
  • buildNativeToolPath — shim dir placed first
  • buildNativeToolPath — cliToolsDir placed before basePath
  • buildNativeToolPath — basePath preserved at end
  • buildNativeToolPath — shimDir omitted when not provided
  • buildNativeToolPath — works with only cliToolsDir
  • buildNativeToolPath — filters empty string entries
  • buildNativeToolPath — filters undefined basePath
  • buildNativeToolPath — correct full ordering with all three entries

Trello card: https://trello.com/c/Y4JTi0vG/564-as-a-developer-i-want-unit-coverage-for-native-tool-runtime-shims-so-that-cascade-native-tool-execution-stays-predictable

🤖 Generated with Claude Code

🕵️ claude-code · claude-sonnet-4-6 · run details

Copy link
Copy Markdown
Collaborator

@nhopeatall nhopeatall left a comment

Choose a reason for hiding this comment

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

LGTM — well-structured unit tests that directly exercise both exported functions from nativeToolRuntime.ts. Tests cover the key behaviors (filesystem creation, shim content, permissions, cleanup idempotency, PATH ordering, and filtering) without over-mocking. All CI checks pass.

Nitpick

  • tests/unit/backends/nativeToolRuntime.test.ts:2beforeEach is imported from vitest but never used in the file. Only afterEach is used.

🕵️ claude-code · claude-opus-4-6 · run details

@aaight aaight merged commit 289a595 into dev Mar 25, 2026
9 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