stack/packages/stack-cli/vitest.config.ts
Bilal Godil 30dbdffc4a faster snapshot resume via mapped-ram + rotation opt-out
Snapshot resume drops from ~14s to ~5-7s with rotation, ~2.5s without.

Build uses QEMU's mapped-ram + multifd migration capability so the RAM
state is written at page-aligned offsets in a sparse file. Runtime
decompresses the shipped .savevm.zst once to a local .raw cache and
reloads via -incoming file: + migrate-incoming on subsequent starts,
avoiding the per-start zstd decode.

Adds EMULATOR_NO_ROTATION=1 for tests/CI that don't mind the placeholder
secrets; saves the full ~3s rotation window.

Misc runtime cleanups: tighter QMP/QGA poll intervals (1s → 0.2s),
shorter socat keep-alive windows, 1s settle before the post-rotation
health-check to avoid racing old Node processes, fallback path preserves
the CLI-generated runtime-config.iso instead of blowing away VM_DIR.

Build-time qmp_session keeps stdin open briefly after the caller's
commands so migrate-set-capabilities is actually processed before
socat closes — without this, mapped-ram was silently a no-op.

CI workflow publishes .savevm.zst alongside the .qcow2 (optional asset;
CLI falls back to cold boot when missing). Test + verify steps go
through the CLI now that ISO generation is owned by packages/stack-cli.
2026-04-15 13:04:15 -07:00

20 lines
532 B
TypeScript

import { defineConfig, mergeConfig } from 'vitest/config';
import sharedConfig from '../../vitest.shared';
export default mergeConfig(
sharedConfig,
defineConfig({
test: {
// Override the shared `maxWorkers: 8` — with it set, tinypool defaults
// minThreads to the host's available parallelism, producing
// "minThreads/maxThreads must not conflict" on machines with >8 cores.
poolOptions: {
threads: {
minThreads: 1,
maxThreads: 4,
},
},
},
}),
);