Files
torlink/vitest.config.ts
bairon.dev 14b4a5ede6 feat: seed downloads by default (opt-out) with robust resume and clean quit
Finished downloads now keep seeding automatically and you opt out per item with
p, reusing the live torrent instead of tearing it down. Resume and restore seed
from the .torrent metadata captured at download time, so they verify the local
file immediately rather than depending on re-fetching metadata from the swarm.

Quitting now flushes queue, history, and seeds synchronously and exits
immediately, fixing the hang when quitting while seeding or with a paused seed.
Paused seeds persist their state and stay paused across restarts. Hide the
hardware cursor on the splash, and clarify that c removes a finished item the
same way in Downloads and Seeding.

Tests are isolated from the real data dir via a TORLINK_STATE_DIR override plus
vitest config, so runs never touch user data. Adds scripts/verify-seeding.ts
(npm run verify:seeding), an offline-deterministic harness proving seed, pause,
and resume transfer real bytes.
2026-06-27 17:02:22 -04:00

16 lines
536 B
TypeScript

import os from "node:os";
import path from "node:path";
import { defineConfig } from "vitest/config";
// Keep tests off the real user data dir: redirect all persisted state (queue /
// history / seeds / config) into a temp folder via the TORLINK_STATE_DIR
// override that src/config/paths.ts honors. Applied before test modules import
// paths.ts, so every write during a run lands here instead.
export default defineConfig({
test: {
env: {
TORLINK_STATE_DIR: path.join(os.tmpdir(), "torlink-test-state"),
},
},
});