test(host-config): skip the claude-detect case when claude is not on PATH

`detect` reports hosts whose binaries are on PATH, so asserting it finds
claude is an assertion about the machine, not about the code. It holds
in CI and in a developer's own session. It does not hold when the suite
runs as a service account, or anywhere claude is installed under a
different user — /root/.local/bin/claude is not on a non-root PATH.

test.skipIf (already used in diagram-render-drift, setup-windows-fallback
and gbrain-sync-voyage-code-3-integration) keeps the check where it is
meaningful and skips it where it can only report the environment.
Coverage in CI is unchanged: claude is on PATH there, so it still runs.

Renamed to drop "since we are running in claude", which is the
assumption that turned out not to be universal.

Verified:
  claude absent (this box)  76 pass, 1 skip, 0 fail
  fake claude on PATH       test runs and passes
This commit is contained in:
tranthanhnhatkhoa 2026-08-08 13:28:28 +02:00
parent 960c3a8d6c
commit 26aaea2eb0
1 changed files with 9 additions and 2 deletions

View File

@ -401,10 +401,17 @@ describe('host-config-export.ts CLI', () => {
expect(exitCode).toBe(1);
});
test('detect finds claude (since we are running in claude)', () => {
// `detect` reports the hosts whose binaries are on PATH, so asserting it
// finds claude is really an assertion about the machine. That holds in CI and
// in a developer's own session; it does not hold when the suite runs as a
// service account, or anywhere claude is installed for a different user.
// Skipping there keeps the suite runnable off a dev box without weakening the
// check where it is meaningful — it still runs wherever claude is present.
const claudeOnPath = Bun.which('claude') !== null;
test.skipIf(!claudeOnPath)('detect finds claude (when claude is on PATH)', () => {
const { stdout, exitCode } = run('detect');
expect(exitCode).toBe(0);
// claude binary should be on PATH in this environment
expect(stdout).toContain('claude');
});