Tune LATdx behavior without editing config files.
User-facing env vars consumed by the latdx CLI and core engine. CI/release-only vars (consumed by build and release tooling, not the latdx binary) are not documented here.
Precedence: CLI flag > env var > user-global config (~/.latdx/config.json, written by latdx config set) > built-in default. Use latdx config set for persistent configuration; the env vars below are for ephemeral overrides and debug escape hatches.
The latdx config CLI command exposes a small set of keys (channel, autoUpdate, latdxBaseUrl); see cli-reference.md.
Logging and output
| Variable | Description | Default |
|---|---|---|
LATDX_LOG_LEVEL | CLI log verbosity. One of error, warn, warning, info, debug, trace, off, silent (warning aliases warn; silent aliases off). Overridden by -q / -v. | warn |
LATDX_LOG_FORMAT | Output format (text, json). Overridden by --json. | text |
LATDX_RENDER_STYLE | Live test renderer style for latdx test run. One of compact, sf, flight. Overridden by --render-style <style>. Unrecognized values fall back to the default. | compact |
NO_COLOR | Any non-empty value disables ANSI color (per no-color.org ). Also honored via --no-color. | unset |
CI | Any value except empty or an explicit opt-out (false, 0, off, no, any casing) marks the run as CI: disables spinners, the live renderer, and default progress snapshots; forces plain output; auto-confirms prompts. | unset |
LATDX_DEBUG | Enable namespaced trace channels (stderr). Accepts true / 1 (legacy) or namespace patterns. See LATDX_DEBUG namespace patterns in cli-reference.md. | unset |
LATDX_AUTO_UPDATE | Set to 0, false, off, or no (case-insensitive) to disable the silent background self-update. Overrides the autoUpdate config key. See Automatic Background Updates in installation.md. CI runs are always skipped regardless. | unset |
LATDX_LOG_FILE | Path override for the per-run CLI NDJSON log. Default writes to ~/.latdx/workspaces/<id>/logs/latdx-<runId>.ndjson. Set to off / disabled / false / 0 to disable the file sink entirely. | unset |
LATDX_DAEMON_LOG_FILE | Path override for the daemon-side NDJSON log. Default writes to ~/.latdx/workspaces/<id>/logs/latdx-daemon-<runId>.ndjson. Set to off / disabled / false / 0 to disable. | unset |
LATDX_LOG_MAX | Maximum number of NDJSON log files to keep per directory (CLI and daemon prune independently on startup). 0 disables pruning. | 10 |
There is no --log-level flag by design: LATDX_LOG_LEVEL is env-only to keep the global flag surface compact. The --json flag is the canonical way to flip LATDX_LOG_FORMAT; the env var exists for callers that want NDJSON logs without flipping a per-command payload-shape switch.
Test execution
Defaults: --engine sf + --db normal. Anything else is experimental and gated behind LATDX_EXPERIMENTAL=1. Without the enabler, supplying any non-default value (flag or env var) errors with ExperimentalFeatureError.
| Variable | Description | Default | Experimental |
|---|---|---|---|
LATDX_EXPERIMENTAL | Enabler for experimental run-mode knobs and experimental subcommands (adapt, boost, clean, restore, uninstall). Truthy values: 1, true, yes, on (case-insensitive). Without the enabler the experimental subcommands are not registered (latdx --help omits them; invocation exits non-zero with “unknown command”). | unset | n/a |
LATDX_ENGINE | Test execution engine. sf (default) dispatches via @salesforce/apex-node’s TestService (class-granular coverage); latdx (experimental) uses the LATdx anon-apex runtime. | sf | latdx |
LATDX_DB | Database backing. normal (default) hits the org DB; mocked (experimental) uses LATdx in-memory simulation. | normal | mocked |
LATDX_LATDB | Alias: off/0/false maps to --db normal. Experimental in any non-default setting. | unset | off |
LATDX_BATCH_MODE | Packed-batch packing strategy. turbo (default) maximizes parallelism; eco (experimental) maximizes payload density. | turbo | eco |
LATDX_ANON_MODE | Anon-Apex emission. named (default) invokes by name; inline (experimental) inlines the test body into the ExecuteAnonymous payload. | named | inline |
When any value diverges from the default, the run header echoes the active value (e.g. Engine: latdx, DB: mocked, Cache: off) so non-standard runs are obvious in the output.
Test result cache (ADR 0009)
The cache is on by default; safety comes from the phase gate, not from a flag (see test-caching.md). All of these switches are honoured by @latdx/core’s CachingTestRunner:
| Variable | Description | Default | Experimental |
|---|---|---|---|
LATDX_CACHE_DISABLE | Hard kill switch. Truthy values (1, true, on, yes, case-insensitive) skip every cache code path; the engine runs every method regardless of phase. | unset | n/a |
LATDX_CACHE_PHASE | Active phase. 0 is the safe baseline: every test runs (results are cached but never reused). 1 enables CLOSURE_EMPTY. 2 adds CLOSURE_INVARIANCE. 3 adds SCHEMA_REV. 4 (default) adds per-method body, dynamic-pessimism, and schema-closure rules (requires Java 11+ on PATH or JAVA_HOME). Out-of-range or unparseable values clamp to 4. | 4 | n/a |
LATDX_CACHE_RULE_<NAME> | Per-rule disable. 0, false, off, no (case-insensitive) disables the named rule even when the active phase would otherwise include it. Known rules: CLOSURE_EMPTY, CLOSURE_INVARIANCE, SCHEMA_REV, METHOD_BODY_INVARIANCE, SCHEMA_CLOSURE, DYNAMIC_PESSIMISM. | unset | n/a |
LATDX_CACHE_SHADOW_RATE | Shadow-validation sample rate in [0, 1]. On runs that already execute some tests, this fraction of cache hits is re-run on the org and compared against the cached result; a disagreement is reported and the fresh result wins. Never fires on a full cache hit (no extra org round-trip). 0 disables it. Out-of-range or unparseable values fall back to the default. | 0.01 | n/a |
Salesforce integration
| Variable | Description | Default |
|---|---|---|
LATDX_SKIP_TEST_RUNNER_ACCESS | Skip auto-deploy/assign of the latdx_TestRunnerAccess permset. Values: 1, true. | unset |
LATDX_SKIP_TEST_RUNNER_ACCESS is read when the daemon starts. If the daemon is already running, stop it (latdx daemon stop) and re-launch with the env var set so the daemon child inherits it.
Licensing
| Variable | Description | Default |
|---|---|---|
LATDX_BASE_URL | LATdx site base URL for browser auth and live license/access checks. Overrides latdxBaseUrl in ~/.latdx/config.json; useful for local dev and staging smoke tests. | unset |
LATDX_LICENSE_BASE_URL | Legacy alias for LATDX_BASE_URL. Prefer LATDX_BASE_URL for new scripts. | unset |
LATDX_LICENSE_KEY | CLI identity token. Read before ~/.latdx/license.key and forwarded to the daemon for the current run. Useful on headless boxes and CI where the browser sign-in flow (latdx auth login) is not available. Plan/access is resolved live by the site; unlicensed/free runs cap at 100. | unset |
LATDX_LICENSE_GRACE_SECONDS | Offline access grace window after a successful live resolve. If the license site is unreachable, the same token and same license host may reuse the last signed access proof for this many seconds before dropping to Free. | 86400 |
Diagnostics
| Variable | Description | Default |
|---|---|---|
LATDX_KEEP_TEMP_FILES | Keep temp working directories on disk after a run. Useful for support tickets. Values: true. | unset |
LATDX_KEEP_SF_LOGS | Skip deletion of Apex debug logs after a run. Values: true. | unset |
Interactive behavior
| Variable | Description | Default |
|---|---|---|
LATDX_AUTO_CONFIRM | Auto-confirm interactive prompts (currently only the debug-log-storage cleanup prompt). Useful for non-interactive shells where CI is not set. Values: true. | unset |
Internal (set automatically; do not configure manually)
| Variable | Description | Set by |
|---|---|---|
LATDX_DAEMON | Signals the child process is running in daemon mode. | DaemonSpawner |
LATDX_DAEMON_LOG | Daemon log file path. | DaemonSpawner |
LATDX_DAEMON_IPC_ENDPOINT | IPC socket / named-pipe path used by the daemon. | CLI / DaemonSpawner |
LATDX_WORKSPACE_ID | Workspace identity passed to daemon child. | DaemonSpawner |
LATDX_WORKSPACE_ROOT | Worktree root passed to daemon child. | DaemonSpawner |
SFDX_DISABLE_LOG_FILE, SF_DISABLE_LOG_FILE | Disable SFDX file logging in Bun-compiled binaries. | CLI entrypoint |
The internal variables above are set automatically by the CLI and daemon spawner. Setting them manually can corrupt daemon state or break IPC; treat them as read-only diagnostic signals.
Removed / deprecated
These environment variables are not read by the CLI. Where a user-facing equivalent exists, use it instead:
| Variable | Replacement |
|---|---|
LATDX_COVERAGE_ENABLED | --coverage flag (opt-in) |
LATDX_TURBO_WORKERS | --concurrency <n> flag |
LATDX_TEST_MODE | LATDX_LATDB=off for full mode |
LATDX_HTTP_ENABLED | Internal config (httpServer.enabled); not user-configurable |
LATDX_HTTP_PORT | Internal config (httpServer.port); not user-configurable |