react-native-launch-arguments
react-native-launch-arguments copied to clipboard
Undefined values are not serialized correctly
Problem Description
If launch arguments are passed with an undefined value, when read back, those values are received as a string "undefined"
. For example:
import { device } from 'detox'
await device.launchApp({ launchArgs: { myValue: undefined } })
...
import { LaunchArguments } from 'react-native-launch-arguments'
const launchArgs = LaunchArguments.value()
console.log(inspect(launchArgs))
>>> { detoxSessionId: 'bd1e...', detoxServer: 'ws://localhost:65078', myValue: 'undefined' }
Expected Behavior
I would expect that when read back, the value should actually be undefined
, not a string.
Passing undefined values also fails on Android, but with an error:
TypeError: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined