function parseIdleTimeout
parseIdleTimeout(value: string | undefined): ParsedIdleTimeout

Parses the QUNITX_DAEMON_IDLE_TIMEOUT env value. Accepts:

  • undefined / empty: default (30 min), no warning
  • "false" (case-insensitive): Infinity — no auto-shutdown, no warning
  • bare number, treated as minutes: "30" → 1_800_000
  • suffixed number (ms | s | m | h): "1h", "45s", "500ms"
  • fractional values: "0.5h" → 1_800_000

Whitespace and suffix case are tolerated. Anything else (non-numeric, zero or negative, unknown suffix) falls back to the default and returns a warning string — the daemon must not refuse to start over a malformed env var, but the user does need feedback that their override was ignored.

Pure: no side effects, no env access — caller passes the raw value.

parseIdleTimeout('30').ms; // 1_800_000 — bare number means minutes
parseIdleTimeout('500ms').ms; // 500
parseIdleTimeout('false').ms; // Infinity — no auto-shutdown
parseIdleTimeout('soon').warning; // '⚠ qunitx: … not a valid duration; using 30-minute default …'

Parameters

value: string | undefined

Return Type

Usage

import { parseIdleTimeout } from "lib/commands/daemon/parse-idle-timeout.ts";