// Loaded before every test file (bunfig.toml): no real waiting between the re-checks of cli/lib/upsert.ts or for // the store's list to settle after a create (cli/apple/iap.ts). import { afterEach } from 'bun:test'; import { mkdtempSync } from 'node:fs'; import { tmpdir } from 'node:os'; import { join } from 'node:path'; process.env.STOREBOUND_UPSERT_WAIT_MS = '0'; process.env.STOREBOUND_LIST_SETTLE_MS ??= '0'; // The machine-wide stores (credential profiles, the app folder list) of the person running the tests are never read // or written: every test process gets empty ones (a test that needs content points these at its own folder). const machine = mkdtempSync(join(tmpdir(), 'storebound-machine-')); process.env.STOREBOUND_CREDENTIALS_DIR = join(machine, 'credentials'); process.env.STOREBOUND_REGISTRY = join(machine, 'projects.json'); // Commands run in-process set process.exitCode on purpose (a check with problems, a declined confirmation: // DECLINED_EXIT in cli/lib/ctx.ts). Tests assert it where it matters; it must not leak into bun test's own exit code. afterEach(() => { process.exitCode = 0; });