This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
EAS 模拟器命令行参考
用于实验性 EAS CLI 命令的参考,这些命令可以创建、检查、监控、控制、列出和停止远程模拟器会话。
simulator:* 命令是实验性的且隐藏的。在运行它们之前,请先安装或更新 EAS CLI:
🌐 The simulator:* commands are experimental and hidden. Install or update EAS CLI before running them:
--help 标志显示 simulator:start 的可用选项。
🌐 The --help flag displays the available options for simulator:start.
启动命令也可以用 eas simulator、eas sim 和 eas sim:start 来使用。其他命令也有对应的 eas sim:* 别名,比如 eas sim:list 和 eas sim:stop。
🌐 The start command is also available as eas simulator, eas sim, and eas sim:start. The other commands have matching eas sim:* aliases, such as eas sim:list and eas sim:stop.
如果不使用 EAS CLI 管理会话,可以使用 REST API。
🌐 To manage sessions without EAS CLI, use the REST API.
命令
🌐 Commands
simulator:availability
--json 标志是可选的。它会打印一个稳定的、供代理和自动化使用的可机器读取结果;如果想要人类可读的输出,可以省略它。JSON 对象包含 available 和 accountName。这个命令不会创建会话,也不会消耗模拟器使用次数。
🌐 The --json flag is optional. It prints a stable, machine-readable result for agents and automation; omit it for human-readable output. The JSON object contains available and accountName. This command does not create a session or consume simulator usage.
simulator:start
会话类型决定了 EAS 向远程设备提供哪种界面。在 iOS 上,每种类型都包括网页预览。选择 agent-device、Argent 或 Appium 来添加程序化控制,或者只选择 web-preview-only 以仅使用网页预览:
🌐 The session type determines which interface EAS provisions with the remote device. On iOS, every type includes a web preview. Choose agent-device, Argent, or Appium to add programmatic control, or choose web-preview-only for the web preview only:
使用 agent-device 来进行无障碍驱动的设备操作和应用安装。
🌐 Use agent-device for accessibility-driven device actions and app installation.
当你想连接已有的 Appium 客户端或测试套件时,使用 Appium。
🌐 Use Appium when you want to connect an existing Appium client or test suite.
在不配置编程控制器的情况下使用 iOS 网页预览。
🌐 Use the iOS web preview without provisioning a programmatic controller.
重要的标志:
🌐 Important flags:
--max-duration-minutes | 自动会话停止时间。付费套餐可自定义数值;否则默认值取决于任务优先级
| --max-idle-time-minutes | 在没有会话活动的情况下,多少分钟后停止。如果省略,会话没有空闲超时,会一直运行到最大持续时间 |
| --network-capture | 从 iOS 设备上的应用记录 HTTP(S) 流量。见 记录网络流量 |
| --network-capture-field | 一个录音还会保存:header、query、request-body 或 response-body。可重复或用逗号分隔。需要 --network-capture |
| --out-config-type | dotenv 来编写 .env.eas-simulator,或者 env 来打印 shell 导出 |
| --[no-]force | 当环境中已存在会话 ID 时,是否创建新会话。默认值为 true |
| --non-interactive | 会话准备好后再返回,而不是保持附着 |
| --json | 打印机器可读的输出,并意味着非交互模式 |
--build-id、--application-archive-url 和 --expo-go 是互斥的应用来源。--launch-arg 和 --open-url 需要其中一个来源,因为启动命令需要已安装的应用来启动。
默认的 dotenv 输出即使在使用 --json 时也会写入配置。当你明确不想要文件时,使用 --out-config-type env。
🌐 The default dotenv output writes configuration even when --json is used. Use --out-config-type env when you explicitly do not want the file.
常见的 JSON 输出字段是这种格式的。remoteConfig 里面的字段取决于所选的控制器:
🌐 Common JSON output fields have this shape. The fields inside remoteConfig depend on the selected controller:
{ "id": "<session-id>", "name": "Checkout flow screenshots", "type": "<controller-type>", "deviceRunSessionUrl": "https://expo.dev/accounts/<account>/projects/<project>/simulator-sessions/<session-id>", "remoteConfig": { "<controller-specific-key>": "<value>" } }
把 remoteConfig 当作秘密处理,因为它包含控制器的凭证。
🌐 Treat remoteConfig as secret because it includes controller credentials.
交互式和非交互式行为
🌐 Interactive and non-interactive behavior
没有 --non-interactive,启动命令会一直附着并轮询会话。按一次 Ctrl+C 就可以停止它。EAS CLI 在确认会话结束后会重置 .env.eas-simulator。
🌐 Without --non-interactive, the start command stays attached and polls the session. Press Ctrl+C once to stop it. EAS CLI resets .env.eas-simulator after it confirms the session ended.
使用 --non-interactive 或 --json 时,命令会在控制器准备好后返回。你必须单独停止会话。
🌐 With --non-interactive or --json, the command returns after the controller is ready. You must stop the session separately.
simulator:exec
simulator:exec 与控制器无关。它会从 .env.eas-simulator 加载当前会话的连接变量,然后生成后续的命令和参数。
在会话开始时,为选定的控制器使用命令模式:
🌐 Use the command pattern for the controller selected when the session started:
simulator:exec 不会执行设备操作。它只提供活动会话的连接环境,并运行随后跟随的命令。可用的操作和参数语法来自 agent-device 或 Argent。
simulator:events
显示针对 .env.eas-simulator 所引用会话记录的活动快照:
🌐 Show a snapshot of the activity recorded for the session referenced by .env.eas-simulator:
传递一个会话ID来查看另一个会话:
🌐 Pass a session ID to inspect another session:
默认的文本输出会将相关操作浓缩成一个可读的时间线。它会在可用时包含时间戳、控制器、摘要和持续时间。这个命令显示的是来自代理设备或Argent的会话和控制器活动,而不是应用运行日志。
🌐 The default text output condenses related operations into a readable timeline. It includes the timestamp, controller, summary, and duration when available. This command shows session and controller activity from agent-device or Argent, not application runtime logs.
在会话进行时关注新的活动:
🌐 Follow new activity while a session is running:
-f 短标志等同于 --follow。会话结束时命令会停止跟随。按 Ctrl + C 可以提前停止跟随。
对于代理和自动化,请以 JSON 格式请求原始事件记录:
🌐 For agents and automation, request the raw event records as JSON:
这个 JSON 对象包含 deviceRunSessionId 和一个 events 数组。常见的事件字段包括 eventId、ts、producer、type 和 summary,在可用时还包括操作 ID、结果、持续时间和控制器特定的数据。--json 不能与 --follow 一起使用。
🌐 The JSON object contains deviceRunSessionId and an events array. Common event fields include eventId, ts, producer, type, and summary, with operation ID, outcome, duration, and controller-specific data when available. --json cannot be combined with --follow.
simulator:get
获取 .env.eas-simulator 引用的会话:
🌐 Get the session referenced by .env.eas-simulator:
明确地再来一次会话:
🌐 Get another session explicitly:
回应包括:
🌐 The response includes:
- ID、名称、类型、状态和平台
- 创建、开始、完成和更新时间戳
- expo.dev 模拟器会话网址
- 控制器连接配置
- 会话产物(如果有的话)
simulator:list
过滤器可以重复使用:
🌐 Filters can be repeated:
使用 --limit 来控制页面大小,并用上一次响应的 endCursor 搭配 --after 进行分页。
🌐 Use --limit to control page size and --after with the previous response's endCursor for pagination.
simulator:stop
停止由 .env.eas-simulator 引用的会话:
🌐 Stop the session referenced by .env.eas-simulator:
停止特定会话:
🌐 Stop a specific session:
终止突变是幂等的。
🌐 The stop mutation is idempotent.
使用 --json 来表示一个包含会话 id 和最终结果 status 的机器可读对象。
🌐 Use --json for a machine-readable object containing the session id and final status.
.env.eas-simulator
托管文件总是包含会话 ID:
🌐 The managed file always contains the session ID:
控制器连接变量取决于所选择的类型:
🌐 Controller connection variables depend on the selected type:
把文件加到 .gitignore 里:
🌐 Add the file to .gitignore:
在会话运行时不要修改它的值。
🌐 Do not modify its values while the session is running.