Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(iOS): open the Simulator app by default. #3304

Merged
merged 7 commits into from
Apr 13, 2022
14 changes: 7 additions & 7 deletions detox/src/configuration/composeDeviceConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,23 +195,23 @@ function applyCLIOverrides(deviceConfig, cliConfig) {
_assignCLIConfigIfSupported('readonly-emu', cliConfig.readonlyEmu, deviceConfig, 'readonly');
}

function _assignCLIConfigIfSupported(configName, configValue, deviceConfig, deviceConfigKey) {
if (!configValue) {
function _assignCLIConfigIfSupported(argName, argValue, deviceConfig, propertyName) {
if (argValue === undefined) {
asafkorem marked this conversation as resolved.
Show resolved Hide resolved
return;
}

const deviceType = deviceConfig.type;
const supportedDeviceTypesPrefixes = _supportedDeviceTypesPrefixes(configName);
const supportedDeviceTypesPrefixes = _supportedDeviceTypesPrefixes(argName);
if (!supportedDeviceTypesPrefixes.some((prefix) => deviceType.startsWith(prefix))) {
log.warn(`--${configName} CLI override is not supported by device type = "${deviceType}" and will be ignored`);
log.warn(`--${argName} CLI override is not supported by device type = "${deviceType}" and will be ignored`);
return;
}

deviceConfig[deviceConfigKey] = configValue;
deviceConfig[propertyName] = argValue;
}

function _supportedDeviceTypesPrefixes(configName) {
switch (configName) {
function _supportedDeviceTypesPrefixes(argName) {
switch (argName) {
case 'device-name':
return [''];

Expand Down
8 changes: 4 additions & 4 deletions detox/src/configuration/composeDeviceConfig.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,9 @@ describe('composeDeviceConfig', () => {
beforeEach(() => setConfig(deviceType, configType));

it('should override .headless without warnings', () => {
cliConfig.headless = true;
cliConfig.headless = false;
expect(compose()).toEqual(expect.objectContaining({
headless: true,
headless: false,
asafkorem marked this conversation as resolved.
Show resolved Hide resolved
}));

expect(logger.warn).not.toHaveBeenCalled();
Expand All @@ -388,9 +388,9 @@ describe('composeDeviceConfig', () => {
beforeEach(() => setConfig(deviceType, configType));

it('should print a warning and refuse to override .headless', () => {
cliConfig.headless = true;
cliConfig.headless = false;
expect(compose()).not.toEqual(expect.objectContaining({
headless: true,
headless: false,
}));

expect(logger.warn).toHaveBeenCalledWith(expect.stringMatching(/--headless.*not supported/));
Expand Down