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. For steady-state configuration (batch mode, turbo workers, HTTP port, license key, default test mode, coverage), use latdx config set instead of env vars. Env vars below are reserved for ephemeral overrides and debug escape hatches.
The latdx config CLI command currently exposes a single key (channel); see cli-reference.md. The env vars below are reserved for ephemeral overrides and debug escape hatches.
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 non-empty value disables spinners and live renderer; forces plain output. | 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 |
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 | Legacy 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 four 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 (default) is the read-disabled parity floor: writes happen, reads always miss. 1 enables the CLOSURE_EMPTY rule. 2 adds CLOSURE_INVARIANCE. 3 adds SCHEMA_REV. Out-of-range values clamp to 0. | 0 | 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. | unset | n/a |
LATDX_CACHE_SHADOW_RATE | Sampling rate in [0, 1] for shadow-run validation at Phase >= 1. A sampled hit also runs through the engine; mismatches land in <cacheHome>/cache/shadow-mismatches.ndjson and the engine outcome wins. | 0.01 | n/a |
Salesforce integration
| Variable | Description | Default |
|---|---|---|
LATDX_SF_INSTALL_METHOD | How latdx-sf installs into the org. Values: SOURCE, MANAGED_PKG. Defaults to MANAGED_PKG when a managed package id is available (release binaries bake __LATDX_SF_PACKAGE_ID__, or LATDX_SF_PACKAGE_ID is exported); otherwise defaults to SOURCE so dev checkouts run without ceremony. Legacy alias SF_PACKAGE_INSTALL_METHOD is honored with a deprecation warning. | auto |
LATDX_SF_SOURCE_PATH | Override path to the latdx-sf/src/main directory. Highest-priority resolution. Absolute path. | auto-discovered |
LATDX_SF_PACKAGE_ID | Managed package version ID (04t...). Env var beats the compile-time define in release binaries. | baked-in 04t... |
LATDX_SF_PACKAGE_VERSION | Minimum managed-package version expected in the org. Semver string. | baked-in |
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.
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=true is not set. Values: true. Runtime install/upgrade is gated by the explicit --install flag and never reads this variable. | 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
The following env vars are no longer read. CLI flags cover per-run overrides; persistent equivalents live in the VS Code extension’s latdx.* settings (the CLI’s own latdx config exposes only channel).
| Variable | Replacement |
|---|---|
LATDX_COVERAGE_ENABLED | --no-coverage flag, or latdx.execution.enableCoverageAndDecoration (extension) |
LATDX_TURBO_WORKERS | --concurrency <n> flag, or latdx.execution.turboModeWorkers (extension) |
LATDX_TEST_MODE | LATDX_LATDB=off for full mode, or latdx.execution.defaultTestMode (extension) |
LATDX_HTTP_ENABLED | latdx.httpServer.enabled (extension) |
LATDX_HTTP_PORT | latdx.httpServer.port (extension) |
LATDX_LICENSE_KEY | latdx.licenseKey (extension) |
SF_PACKAGE_INSTALL_METHOD | LATDX_SF_INSTALL_METHOD (legacy alias still works with deprecation warning) |