Skip to content

Environment variables ​

Every environment variable Pyro reads, by the component that reads it. The browser binary reads the LIGHTNINGPANDA_* and JSC_* variables, the SDK and the runners read LIGHTNINGPANDA_BIN, LIGHTNINGPANDA_WS and the LP_* variables. Variables marked diagnostic or tuning exist to measure or compare behaviour. They are stable enough to use, but you should not need them.

Quick reference ​

VariableRead byDefaultPurpose
LIGHTNINGPANDA_BINSDK, CLI, runnersbundled binaryBrowser binary to run
LIGHTNINGPANDA_WSPlaywright drop-inlaunch oneConnect to a running server
LP_CONFIGPlaywright drop-inlightningpanda.config.*, playwright.config.*Config file
PLAYWRIGHT_CONFIGPlaywright drop-inFallback for LP_CONFIG
LP_PROJECTPlaywright drop-infirst projectProject to use
LP_RETRIESPlaywright drop-inconfigRetries
LP_TIMEOUTPlaywright drop-inconfigTest timeout, ms
LP_UPDATE_SNAPSHOTSSDK, Playwright drop-in, e2eunsetWrite screenshot baselines
LP_CONCURRENTPlaywright drop-inunsetRun parallel describes concurrently in a worker
NO_COLORtest, e2e reportersunsetDisable colors
LIGHTNINGPANDA_LOCAL_STORAGEserve--local-storage
LIGHTNINGPANDA_STATICserve--static entries
LIGHTNINGPANDA_PREPAREserve--prepare URLs
LIGHTNINGPANDA_PREPARE_REFILLservequiet--prepare-refill
LIGHTNINGPANDA_FORKserveoff--fork
LIGHTNINGPANDA_FORK_SPARESserve --fork2Forks kept waiting
LIGHTNINGPANDA_FORK_PRECOMPILEserve --forkmodulesPrecompile static module scripts
LIGHTNINGPANDA_SPARE_ENGINEserveon with --prepare--spare-engine
LIGHTNINGPANDA_ENGINE_REUSEserve (main)on--engine-reuse
LIGHTNINGPANDA_RENDER_PREWARMserveon with --prepare--render-prewarm
LIGHTNINGPANDA_HYPHEN_DIGIT_BREAKSserveoff--hyphen-digit-breaks
LIGHTNINGPANDA_PARENT_PIDserveset by launch()--parent-pid
LIGHTNINGPANDA_VIRTUAL_TIMEbrowseroffJump the clock to the next timer while a run waits
LIGHTNINGPANDA_FILE_URLSbrowseronServe file: URLs
LIGHTNINGPANDA_SHARED_ASSET_CACHE_MBbrowseroffCross-context cache of public static assets
LIGHTNINGPANDA_PDF_SHADOWSPDF rendereronDraw blurred box shadows in PDFs
JSC_*JavaScriptCoresee belowEngine options

The memory, tuning and diagnostic variables are listed in their own sections below.

SDK and CLI ​

LIGHTNINGPANDA_BIN ​

Path to a lightningpanda binary. The lightningpanda npm command, Lightningpanda.launch() (when no bin option is passed), the Playwright drop-in and the e2e runner use it in place of the bundled binary. Use it for a binary you built yourself, or on a platform with no bundled one. Default: a lightningpanda next to the package (the release-archive layout), else native/<platform>-<arch>/lightningpanda in the package.

sh
LIGHTNINGPANDA_BIN=$HOME/src/lightningpanda/target/release/lightningpanda bun test

LIGHTNINGPANDA_WS ​

The WebSocket endpoint of a running lightningpanda serve (for example ws://127.0.0.1:9222/). The Playwright drop-in (@povio/lightning-panda/playwright and lightningpanda test) connects to it instead of launching a browser per worker, unless the config's lightningpanda.wsEndpoint option is set. Lightningpanda.connect() does not read it, but scripts often pass it: Lightningpanda.connect(process.env.LIGHTNINGPANDA_WS!). See One server, many workers.

LP_CONFIG ​

Path of the Playwright-style config file the drop-in loads (absolute, or relative to the working directory). lightningpanda test -c <file> sets it for its workers. Fallback: PLAYWRIGHT_CONFIG, then lightningpanda.config.{ts,mts,mjs,js}, then playwright.config.{ts,mts,mjs,js} in the working directory. Set it when you run a file with plain bun test.

LP_PROJECT ​

Name of the config project whose settings apply. Default: the first project. An unknown name throws no project named "<name>". When it is unset and the config has several projects, a file takes the project whose testDir/testMatch include it.

LP_RETRIES ​

Retries of a failing test, overriding the config and project values. lightningpanda test --retries <n> sets it.

LP_TIMEOUT ​

Test timeout in ms for every project, overriding the config. lightningpanda test --timeout <ms> sets it.

LP_UPDATE_SNAPSHOTS ​

Write screenshot baselines instead of comparing.

ReaderValues
SDK matchScreenshot steps (updateMode())1, true, all or changed turn update mode on. Passing --update-snapshots or -u to the process (bun test -u) does the same.
Playwright drop-in toHaveScreenshot / toMatchSnapshotall, changed, missing, none (Playwright's updateSnapshots). lightningpanda test -u [mode] sets it (default changed).
lightningpanda e2e -uSets it to 1.

NO_COLOR ​

Any value turns off ANSI colors in the lightningpanda test and lightningpanda e2e console output. Colors are also off when stdout is not a TTY.

NODE_ENV ​

lightningpanda e2e sets it to test if it is unset, as bun test does.

Set by the runners ​

lightningpanda test passes these to its bun test workers. They are internal: do not set them yourself.

LP_WORKER, LP_WORKERS, LP_WORKER_INDEX, LP_RESULTS, LP_FILE_PROJECTS, LP_FILE_OWNERS, LP_FULLY_PARALLEL, LP_GREP, LP_GREP_INVERT and LP_LIST.

LP_CONCURRENT ​

1 makes the Playwright drop-in run the tests of a mode: 'parallel' describe concurrently inside one worker. By default a file's tests run one after another in their worker, since they may share module state that hooks set. Experimental.

serve ​

Each variable is the default for its flag, and the flag wins. Switches take on/off, 1/0 or true/false. A value that does not parse is ignored. Full descriptions are in serve options.

LIGHTNINGPANDA_LOCAL_STORAGE ​

Path of the JSON file for --local-storage. Empty means unset.

LIGHTNINGPANDA_STATIC ​

--static entries ORIGIN=DIR, separated by ;. --static flags add to them. Malformed entries are skipped.

sh
LIGHTNINGPANDA_STATIC='http://app.test=./dist;http://cdn.test=./public'

LIGHTNINGPANDA_PREPARE ​

--prepare URLs, separated by ;. --prepare flags add to them.

LIGHTNINGPANDA_PREPARE_REFILL ​

after-close means --prepare-refill after-close. Any other value means quiet.

LIGHTNINGPANDA_FORK ​

1 means --fork. Other values are ignored.

LIGHTNINGPANDA_FORK_SPARES ​

How many forked processes each fork-mode template keeps waiting for connections. Default 2. Raise it when many connections open at once.

LIGHTNINGPANDA_FORK_PRECOMPILE ​

What the root fork-mode template does with the module scripts of the --static roots before its first page. Every fork then loads them already compiled. Tuning.

ValueEffect
modules (default)Each module is parsed and its top-level code compiled. Functions compile at their first call, in the calling process.
functionsThe code of every function is compiled too. This saves a little CPU per page but costs more memory and page faults.
off, 0Nothing is precompiled.

LIGHTNINGPANDA_SPARE_ENGINE ​

on/off for --spare-engine.

LIGHTNINGPANDA_ENGINE_REUSE ​

on, off, thread or always for --engine-reuse. Only on main, newer than 0.0.33.

LIGHTNINGPANDA_RENDER_PREWARM ​

on/off for --render-prewarm.

LIGHTNINGPANDA_HYPHEN_DIGIT_BREAKS ​

on/off for --hyphen-digit-breaks. Default off.

LIGHTNINGPANDA_PARENT_PID ​

The PID for --parent-pid. Lightningpanda.launch() sets it to its own PID in the server's environment. A fork-mode template removes it from its own environment, so the template ends with its server instead.

Browser behaviour ​

These are read by the browser in any mode (serve, fetch, eval).

LIGHTNINGPANDA_VIRTUAL_TIME ​

1 turns on virtual time. While an LP.run waits and its page has nothing left but timers (no task, request or navigation), the clock jumps to the next timer instead of sleeping until it is due. A debounce or a delayed save then costs no wall time. The jump applies to the whole browser thread, so it is meant for fork mode (one page per process). Time never goes back. Default: off.

LIGHTNINGPANDA_FILE_URLS ​

0 turns off file: URLs. They then fail with net::ERR_UNKNOWN_URL_SCHEME. Default: on, so navigations to file: and the subresources of file: documents read the local filesystem, as Chrome does.

LIGHTNINGPANDA_SHARED_ASSET_CACHE_MB ​

A positive integer turns on a process-wide cache of public static assets shared across browser contexts, with that many MiB (each entry up to 16 MiB). It is read once per process. Default: off, so every context keeps its own HTTP cache.

LIGHTNINGPANDA_PDF_SHADOWS ​

0 skips blurred outset box-shadows when printing to PDF. Default: drawn.

Memory and tuning ​

Tuning. These were added to compare behaviours in benchmarks. The defaults are the measured best choice.

VariableDefaultEffect of setting it
LIGHTNINGPANDA_RELEASE_ON_CLOSEon0: closing a page no longer releases its memory (collection and free pages returned). The memory waits for the engine's next collection
LIGHTNINGPANDA_RELEASE_GROWTH32:25<MB>[:<percent>]: how far the footprint must grow past its low point before a close collects. 0 collects on every close
LIGHTNINGPANDA_RELEASE_PUT_OFF1How many closes past the gate may leave their collection to an idle moment before one collects at once
LIGHTNINGPANDA_DECOMMITpatched behaviourmadvise: keep JavaScriptCore's stock page release. By default, freed pages leave the resident set at once
LIGHTNINGPANDA_HEAP_ARENA (main, macOS)on0: use mimalloc's own arenas for the Rust heap instead of one reserved range whose freed pages leave the resident set at once
LIGHTNINGPANDA_FORK_FAST_EXITon0: a forked connection process tears down as a shared process does instead of exiting at once
LIGHTNINGPANDA_STATIC_DIRECTon0: --static hits go through the I/O thread instead of being answered on the browser thread

Diagnostics ​

Diagnostic. Output formats may change between releases.

VariableOutput
LIGHTNINGPANDA_FORK_STATS=<file>JSON lines appended to <file>, one per fork, reaped child, child life step and precompile in serve --fork
LIGHTNINGPANDA_ENGINE_REUSE_LOG=1 (main)One stderr line per connection end: what became of its engine
LIGHTNINGPANDA_TRACE_MODULES=1One stderr line per step of every ES module load
LIGHTNINGPANDA_FLOW_STATS=1Layout flow statistics
LP_RUN_STEP_TRACE=1Per-step trace records of each LP.run (not LP.act/LP.expect)
LP_POINTER_WAIT_DIAGNOSTICS (any value)Pointer-action timeout messages include why the action was not ready

JavaScriptCore options ​

JavaScriptCore reads JSC_<option> variables once, when it creates its first VM. Pyro sets some defaults for itself unless the variable is already set in the environment:

VariablePyro's defaultWhy
JSC_usePollingTrapstrueThe watchdog (--timeout-ms, termination) must reach JIT-compiled loops
JSC_heapGrowthMaxIncrease1 (3 in fork-mode forks)Lower heap peaks. In forks, fewer collections for short-lived processes
JSC_smallHeapSize41943044 MB between collections instead of 1 MB. 1048576 restores the old trade-off
JSC_useMachForExceptionsfalse (processes that fork)Mach exception ports do not survive fork()
JSC_useDFGJITfalse in fork-mode forksDFG/FTL compilation rarely pays off in a short connection. JSC_useDFGJIT=true restores the default tiers
JSC_jitMemoryReservationSize33554432 in fork-mode forks32 MB JIT pool instead of 512 MB, so fork() is faster on macOS

Any other JSC_* option reaches JavaScriptCore unchanged. Options you set this way are outside what Pyro tests.

AGPL-3.0-only. A derivative of Lightpanda. Built by Povio.