Skip to content

Commit

Permalink
feat(cli): drop --device-launch-args arg
Browse files Browse the repository at this point in the history
BREAKING: use --device-boot-args instead
  • Loading branch information
noomorph committed Nov 3, 2022
1 parent b1ecf10 commit d76cad6
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 123 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Detox is built from the ground up to support React Native projects as well as pu
The following React Native versions have been tested:

| iOS | Android |
|-----------------|---------------------------------------------------------------------------------------------------------------------------|
| --------------- | ------------------------------------------------------------------------------------------------------------------------- |
| 0.68.x - 0.69.5 | 0.68.x - 0.69.5 -<br/>Visibility edge-case: see this [RN issue](https://github.com/facebook/react-native/issues/23870) \* |

Future versions are most likely supported, but have not been tested yet. Please open issues if you find specific issues with newer React Native versions.
Expand Down
7 changes: 0 additions & 7 deletions detox/local-cli/test.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,6 @@ describe('CLI', () => {
expect(logger().warn).not.toHaveBeenCalledWith(DEVICE_LAUNCH_ARGS_DEPRECATION);
});

test('--device-launch-args should serve as a deprecated alias to --device-boot-args', async () => {
await run(`--device-launch-args="--verbose"`);
expect(cliCall().env).toHaveProperty('DETOX_DEVICE_BOOT_ARGS');
expect(cliCall().fullCommand).toMatch(/\bDETOX_DEVICE_BOOT_ARGS="--verbose" /);
expect(logger().warn).toHaveBeenCalledWith(DEVICE_LAUNCH_ARGS_DEPRECATION);
});

test('--app-launch-args should be passed as an environment variable', async () => {
await run(`--app-launch-args="--debug yes"`);
expect(cliCall().env).toHaveProperty('DETOX_APP_LAUNCH_ARGS');
Expand Down
1 change: 0 additions & 1 deletion detox/local-cli/testCommand/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ module.exports = {
describe: 'Override the device name specified in a configuration. Useful for running a single build configuration on multiple devices.',
},
'device-boot-args': {
alias: 'device-launch-args',
group: 'Execution:',
describe: 'Custom arguments to pass (through) onto the device (emulator/simulator) binary when booted.',
},
Expand Down
12 changes: 1 addition & 11 deletions detox/local-cli/testCommand/middlewares.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { getJestBooleanArgs } = require('../utils/jestInternals');
const { simpleUnquote, extractKnownKeys, disengageBooleanArgs } = require('../utils/yargsUtils');

const testCommandArgs = require('./builder');
const { DETOX_ARGV_OVERRIDE_NOTICE, DEVICE_LAUNCH_ARGS_DEPRECATION } = require('./warnings');
const { DETOX_ARGV_OVERRIDE_NOTICE } = require('./warnings');

function applyEnvironmentVariableAddendum(argv, yargs) {
if (process.env.DETOX_ARGV_OVERRIDE) {
Expand All @@ -29,14 +29,6 @@ function applyEnvironmentVariableAddendum(argv, yargs) {
return argv;
}

function warnDeviceAppLaunchArgsDeprecation(argv) {
if (argv['device-boot-args'] && process.argv.some(a => a.startsWith('--device-launch-args'))) {
log.warn(DEVICE_LAUNCH_ARGS_DEPRECATION);
}

return argv;
}

/**
* @param {Record<string, *>} argv
* @returns {{
Expand Down Expand Up @@ -64,12 +56,10 @@ function splitArgv(argv) {
// noinspection JSUnusedGlobalSymbols
module.exports = {
applyEnvironmentVariableAddendum,
warnDeviceAppLaunchArgsDeprecation,
splitArgv,
};

module.exports.default = [
applyEnvironmentVariableAddendum,
warnDeviceAppLaunchArgsDeprecation,
splitArgv,
];
3 changes: 0 additions & 3 deletions detox/local-cli/testCommand/warnings.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const { DEVICE_LAUNCH_ARGS_DEPRECATION } = require('../../src/configuration/utils/warnings');

const DETOX_ARGV_OVERRIDE_NOTICE = `
_____ _____ ___________
/ ___|_ _| _ | ___ \\ $DETOX_ARGV_OVERRIDE is detected
Expand All @@ -22,5 +20,4 @@ const DETOX_ARGV_OVERRIDE_NOTICE = `

module.exports = {
DETOX_ARGV_OVERRIDE_NOTICE,
DEVICE_LAUNCH_ARGS_DEPRECATION,
};
12 changes: 1 addition & 11 deletions detox/src/configuration/collectCliConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ const _ = require('lodash');
const argparse = require('../utils/argparse');
const log = require('../utils/logger').child({ cat: 'config' });

const { DEVICE_LAUNCH_ARGS_GENERIC_DEPRECATION } = require('./utils/warnings');

const asBoolean = (value) => {
if (typeof value === 'boolean') {
return value;
Expand All @@ -25,14 +23,6 @@ const asNumber = (value) => {
: undefined;
};

const deprecateDeviceLaunchArgs = (value) => {
if (value) {
log.warn(DEVICE_LAUNCH_ARGS_GENERIC_DEPRECATION);
}

return value;
};

function collectCliConfig({ argv }) {
const env = (key) => argparse.getArgValue(key);
const get = (key, fallback) => {
Expand All @@ -51,7 +41,7 @@ function collectCliConfig({ argv }) {
configPath: get('config-path'),
configuration: get('configuration'),
debugSynchronization: asNumber(get('debug-synchronization')),
deviceBootArgs: get('device-boot-args', deprecateDeviceLaunchArgs(argparse.getEnvValue('device-launch-args'))),
deviceBootArgs: get('device-boot-args'),
appLaunchArgs: get('app-launch-args'),
deviceName: get('device-name'),
forceAdbInstall: asBoolean(get('force-adb-install')),
Expand Down
1 change: 0 additions & 1 deletion detox/src/configuration/collectCliConfig.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ describe('collectCliConfig', () => {
...asString( ['configuration' , 'DETOX_CONFIGURATION', 'configuration']),
...asNumber( ['debugSynchronization', 'DETOX_DEBUG_SYNCHRONIZATION', 'debug-synchronization']),
...asString( ['deviceBootArgs', 'DETOX_DEVICE_BOOT_ARGS', 'device-boot-args']),
...asString( ['deviceBootArgs', 'DETOX_DEVICE_LAUNCH_ARGS', 'device-launch-args']),
...asString( ['appLaunchArgs', 'DETOX_APP_LAUNCH_ARGS', 'app-launch-args']),
...asString( ['deviceName', 'DETOX_DEVICE_NAME', 'device-name']),
...asBoolean(['forceAdbInstall', 'DETOX_FORCE_ADB_INSTALL', 'force-adb-install']),
Expand Down
12 changes: 0 additions & 12 deletions detox/src/configuration/utils/warnings.js

This file was deleted.

Loading

0 comments on commit d76cad6

Please sign in to comment.