Skip to content

Reuse an already-booted iOS simulator instead of hanging - #45

Merged
ofalvai merged 1 commit into
masterfrom
push-vpsoszulnszv
Aug 25, 2026
Merged

Reuse an already-booted iOS simulator instead of hanging#45
ofalvai merged 1 commit into
masterfrom
push-vpsoszulnszv

Conversation

@ofalvai

@ofalvai ofalvai commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

#44 is going to run a second batch of tests (plain XCTests) on the same booted simulator. Perfect time to solve this known issue.

IOSEmulatorManager.getTargetEmulator always picked the most recent
iPhone simulator from `simctl list`, regardless of whether a
different simulator was already booted. When one was, the boot-ready
check kept failing and the manager tried to boot a second simulator,
which conflicted with the first and hung until the retry loop timed
out.

Now, unless IOS_EMU pins a specific simulator, the picker reuses
whichever simulator is already booted. Rewritten with async/await,
matching the style already used elsewhere in this file.
else {
// Use the simulator specified on the command line.
deferred.resolve(targetIOSEmulator);
IOSEmulatorManager.prototype.getTargetEmulator = async function () {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note how we are converting this old code to modern async/await syntax. That's why the diff is more than a few lines.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates iOS simulator selection to reuse an already-booted simulator and avoid test setup hangs.

Changes:

  • Prefer an active simulator before falling back to the default iPhone.
  • Remove obsolete simulator-shutdown guidance.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
code-push-plugin-testing-framework/script/platform.js Revises iOS simulator selection.
CLAUDE.md Removes outdated shutdown instructions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

let targetEmulator = process.env.IOS_EMU;
if (!targetEmulator) {
try {
const bootedUdid = await testUtil_1.TestUtil.getProcessOutput("xcrun simctl getenv booted SIMULATOR_UDID", { noLogCommand: true, noLogStdOut: true, noLogStdErr: true });

@ofalvai ofalvai Aug 25, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If multiple simulators are already running, this command rejects, the catch selects a different listed iPhone without shutting the existing devices down

I would say this is an expected (although implicit) behavior, not a big deal.

A lone booted tvOS/watchOS device can likewise be selected as the test target.

Technically correct, but not a big deal IMHO in this project's context.

@ofalvai ofalvai mentioned this pull request Aug 25, 2026
@ofalvai
ofalvai merged commit b56835d into master Aug 25, 2026
6 checks passed
@ofalvai
ofalvai deleted the push-vpsoszulnszv branch August 25, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants