Files
e2e/docs/reference/environment.mdx
T

97 lines
5.6 KiB
Plaintext

---
title: Environment variables
description: Every variable the runner and the first-party engines read, and what each one does.
---
The runner and the first-party packages read the variables below and no
others. A **value** counts when it is set and not blank. A **flag** is on
when it is set and not blank, `0`, or `false`, case-insensitive.
## Model
The runner reads no model variable. The provider package behind your model
instance reads its own key: `gateway()` reads `AI_GATEWAY_API_KEY`,
`openrouter()` reads `OPENROUTER_API_KEY`, `openai()` reads `OPENAI_API_KEY`.
A missing key is the provider's own error on the first agent step. See
[Choosing a model](/models).
## Credentials and secrets
| Variable | Reading | Effect |
| --- | --- | --- |
| `E2E_USER_<NAME>_USERNAME` | set | Replaces `credentials.<name>.username` |
| `E2E_USER_<NAME>_PASSWORD` | set | Replaces `credentials.<name>.password` |
| `E2E_SECRET_<NAME>` | set | Replaces the value of `secrets.<name>` |
`<NAME>` is the name uppercased with every character outside `A-Z0-9`
replaced by `_`, so `power-user` becomes `E2E_USER_POWER_USER_USERNAME`. A
variable for a name absent from the config is ignored. An empty value is
`INVALID_CONFIG`.
## Run mode
| Variable | Reading | Effect |
| --- | --- | --- |
| `CI` | flag | CI mode: `retries` defaults to 1 and `workers` to 1, `cache` defaults to `read-only`, a focused test is `ONLY_IN_CI`, and `reuseExisting` on an app command is ignored |
## Diagnostics
| Variable | Reading | Effect |
| --- | --- | --- |
| `NO_COLOR` | set | Plain CLI output. Colors are otherwise on for a TTY or in CI and off when piped |
| `FORCE_COLOR` | set | Colored CLI output even when piped |
| `NODE_OPTIONS` | value | Inspected for a TypeScript `--import` loader, which decides how the runner registers its own module hooks for `.ts` config and test files |
`--debug` and `--ai-trace` are flags, not variables; see
[CLI](/reference/cli#e2e-run).
## Telemetry
| Variable | Reading | Effect |
| --- | --- | --- |
| `E2E_TELEMETRY_DISABLED` | flag | Turns anonymous usage telemetry off. `e2e telemetry disable` saves the same choice in the preferences file |
| `DO_NOT_TRACK` | flag | Same as `E2E_TELEMETRY_DISABLED` |
| `E2E_TELEMETRY_DEBUG` | flag | Prints every telemetry event to stderr instead of sending it |
| `XDG_CONFIG_HOME` | value | Directory of the preferences file, `$XDG_CONFIG_HOME/e2e`; default `~/.config/e2e` |
| `APPDATA` | value | The same on Windows, `%APPDATA%\e2e`; default `~/AppData/Roaming/e2e` |
Telemetry also checks for the markers CI vendors and coding agents set. Only
the derived name is sent.
| Markers | Reported as |
| --- | --- |
| `GITHUB_ACTIONS`, `GITLAB_CI`, `CIRCLECI`, `BUILDKITE`, `JENKINS_URL`, `TRAVIS`, `BITBUCKET_BUILD_NUMBER`, `TF_BUILD`, `TEAMCITY_VERSION`, `CODEBUILD_BUILD_ID`, `VERCEL`, `NETLIFY`, `DRONE`, `SEMAPHORE`, `APPVEYOR`, `WOODPECKER` | `ci_name`: `github-actions`, `gitlab`, `circleci`, `buildkite`, `jenkins`, `travis`, `bitbucket`, `azure-pipelines`, `teamcity`, `aws-codebuild`, `vercel`, `netlify`, `drone`, `semaphore`, `appveyor`, `woodpecker`; `unknown` when only `CI` is set |
| `CLAUDECODE`, `CLAUDE_CODE`, `CURSOR_AGENT`, `CURSOR_TRACE_ID`, `CODEX_SANDBOX`, `CODEX_THREAD_ID`, `CODEX_CI`, `GEMINI_CLI`, `COPILOT_GITHUB_TOKEN`, `COPILOT_MODEL`, `COPILOT_ALLOW_ALL`, `OPENCODE_CLIENT`, `AUGMENT_AGENT`, `ANTIGRAVITY_AGENT`, `REPL_ID`, `AI_AGENT` | `coding_agent`: `claude-code`, `cursor`, `codex`, `gemini-cli`, `copilot`, `opencode`, `augment`, `antigravity`, `replit`, `other` |
| `WSL_DISTRO_NAME` | `wsl: true` |
| `npm_config_user_agent` | `package_manager`: the invoking package manager. `e2e init` reads the same variable to pick the install command |
What is sent and how to read it is on the [Telemetry](/telemetry) page.
## Reporters
`@e2edev/github` reads the variables GitHub Actions sets, when a run finishes:
| Variable | Reading | Effect |
| --- | --- | --- |
| `GITHUB_ACTIONS` | value | Without it the reporter posts nothing and says so |
| `GITHUB_REPOSITORY`, `GITHUB_RUN_ID`, `GITHUB_EVENT_NAME`, `GITHUB_WORKFLOW`, `GITHUB_JOB` | value | Always set by the runner; a job missing one fails the reporter with the variable named. The repository and run id build the artifacts link, the event name is in the "not a pull request" row, and the workflow and job join the marker that lets a rerun find its own comment |
| `GITHUB_TOKEN`, `GH_TOKEN` | value | The token the comment is posted with; the first one set wins. Unset, the job summary is still written |
| `GITHUB_EVENT_PATH`, `GITHUB_REF` | value | The pull request number and head commit from the event payload, or the number from `refs/pull/N/merge` |
| `GITHUB_SHA` | value | The commit source links point at when the event is not about a pull request |
| `GITHUB_SERVER_URL`, `GITHUB_API_URL` | value | The GitHub host, for Enterprise Server; `https://github.com` and `https://api.github.com` by default |
| `GITHUB_STEP_SUMMARY` | value | The job summary file the comment text is appended to |
## Engines
| Variable | Reading | Effect |
| --- | --- | --- |
| `PLAYWRIGHT_BROWSERS_PATH` | value | Playwright's browser cache, honored by the engine's `prepare` hook |
| `E2E_AGENT_DEVICE_POOL_<TARGET>_<digest>` | value | Written by `@e2edev/agent-device` in `prepare` and read by each worker to find its booted device. Not meant to be set by hand |
## What app processes inherit
An app `command` or `service` receives `PATH`, `HOME`, `TMPDIR`, `TMP`,
`TEMP`, `SystemRoot`, and `COMSPEC`, plus whatever `command.env` sets.
`APP_URL` is read by the scaffolded config module, not the runner; pass it
through `command.env` if the dev server needs it too.