import { describe, it, expect } from 'vitest'; import { spawnWorker } from './secretary-spawn.mjs'; describe('secretary-spawn', () => { it('spawns node with [worker, workDir], detached, stdio ignore, and unrefs', () => { const calls = []; let unrefed = false; const fakeSpawn = (cmd, args, opts) => { calls.push({ cmd, args, opts }); return { unref: () => { unrefed = true; } }; }; spawnWorker('C:/themes/alpha', { spawnImpl: fakeSpawn }); expect(calls).toHaveLength(1); expect(calls[0].args[1]).toBe('C:/themes/alpha'); expect(calls[0].args[0]).toMatch(/secretary-worker\.mjs$/); expect(calls[0].opts.detached).toBe(true); expect(calls[0].opts.stdio).toBe('ignore'); expect(unrefed).toBe(true); }); });