Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ This is the log of notable changes to EAS CLI and related packages.

### 🐛 Bug fixes

- [eas-cli] Stop `eas simulator --type` from listing `web-preview-only` twice in `--help`. ([#4321](https://github.com/expo/eas-cli/pull/4321) by [@tchayen](https://github.com/tchayen))

### 🧹 Chores

## [23.2.0](https://github.com/expo/eas-cli/releases/tag/v23.2.0) - 2026-08-31
Expand Down
3 changes: 2 additions & 1 deletion packages/eas-cli/src/commands/simulator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
DEVICE_RUN_SESSION_RESOURCE_CLASS_BY_FLAG_VALUE,
DEVICE_RUN_SESSION_RESOURCE_CLASS_FLAG_VALUES,
DEVICE_RUN_SESSION_TYPE_BY_FLAG_VALUE,
DEVICE_RUN_SESSION_TYPE_FLAG_OPTIONS,
DEVICE_RUN_SESSION_TYPE_FLAG_VALUES,
DeviceRunSessionRemoteConfig,
formatRemoteSessionInstructions,
Expand Down Expand Up @@ -110,7 +111,7 @@ export default class Simulator extends EasCommand {
type: Flags.option({
description:
'Type of simulator session to create. All session types include a web preview. agent-device, appium, and argent also include an automation interface; web-preview-only includes no automation interface.',
options: Object.values(DEVICE_RUN_SESSION_TYPE_FLAG_VALUES),
options: DEVICE_RUN_SESSION_TYPE_FLAG_OPTIONS,
default: DEVICE_RUN_SESSION_TYPE_FLAG_VALUES[DeviceRunSessionType.AgentDevice],
})(),
'package-version': Flags.string({
Expand Down
4 changes: 2 additions & 2 deletions packages/eas-cli/src/commands/simulator/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Log, { link } from '../../log';
import { ora } from '../../ora';
import {
DEVICE_RUN_SESSION_TYPE_BY_FLAG_VALUE,
DEVICE_RUN_SESSION_TYPE_FLAG_VALUES,
DEVICE_RUN_SESSION_TYPE_FLAG_OPTIONS,
deviceRunSessionTypeToFlagValue,
} from '../../simulator/utils';
import { fromNow } from '../../utils/date';
Expand Down Expand Up @@ -63,7 +63,7 @@ export default class SimulatorList extends EasCommand {
type: Flags.option({
description:
'Filter by session type (repeatable). All session types include a web preview. agent-device, appium, and argent also include an automation interface; web-preview-only includes no automation interface.',
options: Object.values(DEVICE_RUN_SESSION_TYPE_FLAG_VALUES),
options: DEVICE_RUN_SESSION_TYPE_FLAG_OPTIONS,
multiple: true,
})(),
platform: Flags.option({
Expand Down
12 changes: 12 additions & 0 deletions packages/eas-cli/src/simulator/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { DeviceRunSessionResourceClass, DeviceRunSessionType } from '../../graph
import {
DEVICE_RUN_SESSION_RESOURCE_CLASS_BY_FLAG_VALUE,
DEVICE_RUN_SESSION_TYPE_BY_FLAG_VALUE,
DEVICE_RUN_SESSION_TYPE_FLAG_OPTIONS,
DEVICE_RUN_SESSION_TYPE_FLAG_VALUES,
deviceRunSessionTypeToFlagValue,
formatRemoteSessionInstructions,
Expand All @@ -19,6 +20,17 @@ const iosAppiumConfig = {
webPreviewUrl: 'https://preview.example.test',
};

describe('DEVICE_RUN_SESSION_TYPE_FLAG_OPTIONS', () => {
it('offers web-preview-only once even though two enum values map to it', () => {
expect(DEVICE_RUN_SESSION_TYPE_FLAG_OPTIONS).toEqual([
'agent-device',
'appium',
'argent',
'web-preview-only',
]);
});
});

describe('Appium simulator configuration', () => {
it('maps the appium CLI value to the GraphQL enum', () => {
expect(DEVICE_RUN_SESSION_TYPE_BY_FLAG_VALUE.appium).toBe(DeviceRunSessionType.Appium);
Expand Down
6 changes: 6 additions & 0 deletions packages/eas-cli/src/simulator/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ export const DEVICE_RUN_SESSION_TYPE_FLAG_VALUES: Record<DeviceRunSessionType, s
[DeviceRunSessionType.WebPreviewOnly]: 'web-preview-only',
};

// ServeSim and WebPreviewOnly share a flag value, so listing the record's values
// directly would offer web-preview-only twice in --help.
export const DEVICE_RUN_SESSION_TYPE_FLAG_OPTIONS = [
...new Set(Object.values(DEVICE_RUN_SESSION_TYPE_FLAG_VALUES)),
];

export const DEVICE_RUN_SESSION_TYPE_BY_FLAG_VALUE = Object.fromEntries(
(Object.entries(DEVICE_RUN_SESSION_TYPE_FLAG_VALUES) as [DeviceRunSessionType, string][]).map(
([type, value]) => [value, type]
Expand Down
Loading