Compare commits

...
Author SHA1 Message Date
expo-tuft[bot]andtchayen 2aa55b2724 [eas-cli] Deduplicate simulator --type flag options
Co-authored-by: tchayen <[email protected]>
2026-08-31 13:44:04 -07:00
5 changed files with 24 additions and 3 deletions

No files matched your search

+2
View File
@@ -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
@@ -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,
@@ -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({
@@ -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';
@@ -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({
@@ -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,
@@ -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);
+6
View File
@@ -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]