Skip to content
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
1 change: 0 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ React Native CodePush is a native module that enables over-the-air updates for R
- For the fast local loop: run `test:setup:ios` once per template/dependency change, then re-run `test:fast:ios` repeatedly while iterating on test/scenario code — this skips `pod install` and re-provisioning on every iteration.
- There's still no "just build, no tests" npm script — for a raw build only, lift the `xcodebuild` invocation out of `RNIOS.buildApp` in `test/test.ts` and run it by hand against the provisioned `TestCodePush.xcworkspace`.
- When debugging a CI failure, don't trust the first plausible-looking theory from log noise — reproduce the exact failing command locally on matching hardware/toolchain before writing up a root cause. This is faster than iterating against multi-hour CI runs and catches wrong hypotheses early.
- Before running `npm run test:setup:ios`, shut down all booted simulators (`xcrun simctl shutdown all`) — the test framework's simulator picker hangs silently (no error) if simulators are already booted outside it.
- `npm run test:setup:ios` provisions a full test app outside the repo (under a system temp/`test-run` dir), not inside `test/` — expect to search for it rather than finding it checked into the repo tree.
- The provisioned test app's `node_modules/@bitrise/code-push-sdk` is a real copy, not a symlink — editing `ios/` (or `android/`) native source in the repo has zero effect on `test:fast:ios` runs until you re-copy those files into that `node_modules` path (or rerun `test:setup:ios`).

Expand Down
47 changes: 19 additions & 28 deletions code-push-plugin-testing-framework/script/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,36 +347,27 @@ var IOSEmulatorManager = (function () {
/**
* Returns the target emulator, which is specified through the command line.
*/
IOSEmulatorManager.prototype.getTargetEmulator = function () {
let _this = this;
if (this.targetEmulator)
return Q(this.targetEmulator);
else {
let deferred = Q.defer();
let targetIOSEmulator = process.env.IOS_EMU;
if (!targetIOSEmulator) {
// If no iOS simulator is specified, get the most recent iOS simulator to run tests on.
testUtil_1.TestUtil.getProcessOutput("xcrun simctl list", { noLogCommand: true, noLogStdOut: true, noLogStdErr: true })
.then((listOfDevicesWithDevicePairs) => {
let listOfDevices = listOfDevicesWithDevicePairs.slice(listOfDevicesWithDevicePairs.indexOf("-- iOS"), listOfDevicesWithDevicePairs.indexOf("-- tvOS"));
let phoneDevice = /iPhone\ \S*\ ?.*?\(([0-9A-Z-]*)\)/g;
let match = phoneDevice.exec(listOfDevices);
deferred.resolve(match[1]);
}, (error) => {
deferred.reject(error);
});
}
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.

if (this.targetEmulator) {
return this.targetEmulator;
}
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.

targetEmulator = bootedUdid.trim();
} catch {
// No simulator is currently booted - fall back to the most recent iOS simulator.
const listOfDevicesWithDevicePairs = await testUtil_1.TestUtil.getProcessOutput("xcrun simctl list", { noLogCommand: true, noLogStdOut: true, noLogStdErr: true });
const listOfDevices = listOfDevicesWithDevicePairs.slice(listOfDevicesWithDevicePairs.indexOf("-- iOS"), listOfDevicesWithDevicePairs.indexOf("-- tvOS"));
const phoneDevice = /iPhone\ \S*\ ?.*?\(([0-9A-Z-]*)\)/g;
const match = phoneDevice.exec(listOfDevices);
targetEmulator = match[1];
}
return deferred.promise
.then((targetEmulator) => {
_this.targetEmulator = targetEmulator;
console.log("Using iOS simulator named " + _this.targetEmulator);
return _this.targetEmulator;
});
}
this.targetEmulator = targetEmulator;
console.log("Using iOS simulator named " + this.targetEmulator);
return this.targetEmulator;
};
/**
* Boots the target emulator.
Expand Down