Skip to content

feat: allow passing command line arguments running an app in the iOS Simulator #5518

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

Merged
merged 3 commits into from
Jun 1, 2021
Merged
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
4 changes: 4 additions & 0 deletions docs/man_pages/project/testing/run-ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ Start an emulator with specified device identifier and sdk | `$ tns run ios [--d
* `--env.hiddenSourceMap` - creates sources maps in the root folder (useful for Crashlytics usage with bundled app in release).
* `--force` - If set, skips the application compatibility checks and forces `npm i` to ensure all dependencies are installed. Otherwise, the command will check the application compatibility with the current CLI version and could fail requiring `tns migrate`.

### Environment Variables

* `IOS_SIMULATOR_RUN_ARGS` - specifies extra command line arguments to pass to the application when running on the iOS Simulator. E.g. `$ IOS_SIMULATOR_RUN_ARGS=-FIRDebugEnabled ns device run ios`.

<% } %>
<% if(isHtml) { %>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,14 @@ export class IOSSimulatorApplicationManager extends ApplicationManagerBase {
public async startApplication(
appData: Mobile.IStartApplicationData
): Promise<void> {
const args = process.env.IOS_SIMULATOR_RUN_ARGS || "";
const options = appData.waitForDebugger
? {
waitForDebugger: true,
args: "--nativescript-debug-brk",
args: `--nativescript-debug-brk ${args}`.trim(),
}
: args
? { args }
: {};
await this.setDeviceLogData(appData);
const launchResult = await this.iosSim.startApplication(
Expand Down