Environment Variables
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.
CLI updates
| Variable | Description | Default |
|---|---|---|
GITHUB_TOKEN | GitHub token that authenticates the GitHub API requests made by latdx upgrade, latdx upgrade check, and the background update check (the latest channel’s release listing, and the stable fallback when github.com’s release page gives no answer). Set it on a shared CI runner or behind NAT, where the 60 anonymous requests per hour per IP address run out. When GitHub rejects the token (for example an expired CI job token), the request is retried once without it. | unset |
GH_TOKEN | Used the same way as GITHUB_TOKEN when GITHUB_TOKEN is unset. | unset |
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 |
The run header does not show engine, db, batch or anon mode. Its only additions are a cache off chip when the cache is off for the run (cache off (LATDX_CACHE_DISABLE=1) for the kill switch, cache off (--no-cache) for the flag) and auto-confirm when the run is non-interactive without --yes.
Test result cache
The cache is on by default. Turn it off for one command with --no-cache, or for every run with LATDX_CACHE_DISABLE=1; --force refreshes it (see test caching):
| Variable | Description | Default | Experimental |
|---|---|---|---|
LATDX_CACHE_DISABLE | Hard kill switch. Truthy values (1, true, on, yes, case-insensitive) stop cached results from being reused or stored, so the engine runs every selected method. It also turns off the --affected step that leaves out unchanged tests, so every test --affected selects runs. | unset | n/a |
LATDX_CACHE_PHASE | Deprecated and ignored. Setting it has no effect except a warning from latdx test run and latdx validate asking you to remove it. Use --no-cache / LATDX_CACHE_DISABLE=1 to turn the cache off. | unset | n/a |
LATDX_CACHE_RULE_<NAME> | Accepted for compatibility. Disabling a rule does not stop a matching cache key from being served, because the remaining rules still authorize the hit. Use --no-cache or LATDX_CACHE_DISABLE=1 to force tests to run. | unset | n/a |
LATDX_CACHE_RULE_POSITION_IDENTICAL_SAVE | Not a skip rule: it controls what the daemon does when you save a class. On by default, a .cls save that changes no Apex code and moves no code (for example rewording a comment) keeps cached test results, with the exceptions listed in Invalidation. 0, false, off, no (case-insensitive) turns this off, so the first save after a test run with the cache on clears cached results whatever it changed. The daemon reads it once, when it starts, from the environment of the command that starts it (usually your first latdx test run). Setting it for one command does not change a running daemon; run latdx daemon restart and start your next test run with the new value. | 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. On a disagreement, that run uses the fresh result and counts it in --json (cacheReport.shadowMismatches); no terminal warning is shown and the stored result is kept, so refresh it with --force. 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 or answers without a verdict (a 5xx, a 429, or an HTML error page), the same token and same license host may reuse the last signed access proof for this many seconds before dropping to Free. Only an explicit rejection of the token asks you to sign in again. | 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 |