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.7 KB
Raw Blame
import { describe, expect, it } from 'bun:test';
import {
  resolveVoltaShim,
  selectWindowsCommandCandidate,
} from '../../src/shared/spawn.js';

describe('Windows #3677 - Volta Bun shims resolve to the native executable', () => {
  it('prefers the native executable returned for a Volta shim', () => {
    const shim = 'C:\\Users\\tester\\AppData\\Local\\Volta\\bin\\bun.cmd';
    const executable = 'C:\\Users\\tester\\AppData\\Local\\Volta\\tools\\image\\bun\\1.3.11\\bun.exe';

    expect(selectWindowsCommandCandidate([shim], candidate => {
      expect(candidate).toBe(shim);
      return executable;
    })).toBe(executable);
  });

  it('keeps a non-Volta command shim when no native target is resolved', () => {
    const shim = 'C:\\Users\\tester\\AppData\\Roaming\\npm\\bun.cmd';
    expect(selectWindowsCommandCandidate([shim], () => null)).toBe(shim);
  });

  it('resolves the first stdout line from a successful Volta probe', () => {
    const shim = 'C:\\Users\\tester\\AppData\\Local\\Volta\\bin\\bun.cmd';
    const executable = 'C:\\Users\\tester\\AppData\\Local\\Volta\\tools\\image\\bun\\1.3.11\\bun.exe';
    expect(resolveVoltaShim('bun', shim, () => ({ status: 0, stdout: `${executable}\r\nignored\r\n` }))).toBe(executable);
  });

  it('bounds a stalled Volta probe and falls back to the shim', () => {
    const shim = 'C:\\Users\\tester\\AppData\\Local\\Volta\\bin\\bun.cmd';
    let timeout: number | undefined;

    const selected = selectWindowsCommandCandidate([shim], candidate =>
      resolveVoltaShim('bun', candidate, (_command, _args, options) => {
        timeout = options.timeout;
        return { status: null, stdout: '' };
      }),
    );

    expect(timeout).toBe(5_000);
    expect(selected).toBe(shim);
  });
});