Skip to content

Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More

1.2 KB
Raw Blame
import { describe, expect, it } from 'bun:test';
import { claudeCodeInstallCommand } from '../../src/npx-cli/commands/install.js';
import { mkdtempSync, writeFileSync, rmSync } from 'node:fs';
import { join } from 'node:path';
import { tmpdir } from 'node:os';
import { spawnSync } from 'node:child_process';

describe.skipIf(process.platform === 'win32')('Claude Code host installation failures', () => {
  function runDownload(script: string): number | null {
    const dir = mkdtempSync(join(tmpdir(), 'cmem-host-download-'));
    try {
      writeFileSync(join(dir, 'curl'), '#!/bin/sh\n' + script, { mode: 0o755 });
      return spawnSync('/bin/bash', ['-c', claudeCodeInstallCommand(false)], {
        env: { ...process.env, PATH: dir + ':/usr/bin:/bin' },
        encoding: 'utf8', timeout: 5000,
      }).status;
    } finally { rmSync(dir, { recursive: true, force: true }); }
  }

  it('reports a download failure even when the empty installer shell exits successfully', () => {
    expect(runDownload('exit 7\n')).toBe(7);
  });

  it('preserves the native installer failure and success statuses', () => {
    expect(runDownload('printf "exit 9\\n"\n')).toBe(9);
    expect(runDownload('printf "exit 0\\n"\n')).toBe(0);
  });
});