Skip to content

Commit e1a436b

Browse files
committed
Fix console.log regression after introducing ios-sim async api
1 parent 7b16e18 commit e1a436b

11 files changed

+17
-17
lines changed

lib/definitions/ios-debugger-port-service.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ interface IIOSDebuggerPortService {
2424
* In case when STARTING_IOS_APPLICATION event is emitted, sets the port to null and add timeout for 5000 miliseconds which checks if port is null and prints a warning.
2525
* @param {Mobile.IDevice} device - Describes the device which logs should be parsed.
2626
* @param {IProjectDir} data - Object that has a projectDir property.
27-
* @returns {void}
27+
* @returns {Promise<void>}
2828
*/
29-
attachToDebuggerPortFoundEvent(device: Mobile.IDevice, data: IProjectDir): void;
29+
attachToDebuggerPortFoundEvent(device: Mobile.IDevice, data: IProjectDir): Promise<void>;
3030
}

lib/definitions/ios-log-parser-service.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ interface IIOSLogParserService extends NodeJS.EventEmitter {
33
* Starts looking for debugger port. Attaches on device logs and processes them. In case when port is found, DEBUGGER_PORT_FOUND event is emitted.
44
* @param {Mobile.IDevice} device - Describes the device which logs will be processed.
55
*/
6-
startParsingLog(device: Mobile.IDevice, data: IProjectName): void;
6+
startParsingLog(device: Mobile.IDevice, data: IProjectName): Promise<void>;
77
}

lib/definitions/livesync.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ interface IPlatformLiveSyncService {
337337
fullSync(syncInfo: IFullSyncInfo): Promise<ILiveSyncResultInfo>;
338338
liveSyncWatchAction(device: Mobile.IDevice, liveSyncInfo: ILiveSyncWatchInfo): Promise<ILiveSyncResultInfo>;
339339
refreshApplication(projectData: IProjectData, liveSyncInfo: ILiveSyncResultInfo): Promise<void>;
340-
prepareForLiveSync(device: Mobile.IDevice, data: IProjectDir, liveSyncInfo: ILiveSyncInfo): void;
340+
prepareForLiveSync(device: Mobile.IDevice, data: IProjectDir, liveSyncInfo: ILiveSyncInfo): Promise<void>;
341341
}
342342

343343
interface INativeScriptDeviceLiveSyncService extends IDeviceLiveSyncServiceBase {

lib/services/ios-debug-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class IOSDebugService extends DebugServiceBase implements IPlatformDebugS
6363
await this.device.openDeviceLogStream();
6464
}
6565

66-
this.$iOSDebuggerPortService.attachToDebuggerPortFoundEvent(this.device, debugData);
66+
await this.$iOSDebuggerPortService.attachToDebuggerPortFoundEvent(this.device, debugData);
6767

6868
if (debugOptions.emulator) {
6969
if (debugOptions.start) {

lib/services/ios-debugger-port-service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class IOSDebuggerPortService implements IIOSDebuggerPortService {
3636
});
3737
}
3838

39-
public attachToDebuggerPortFoundEvent(device: Mobile.IDevice, data: IProjectDir): void {
39+
public async attachToDebuggerPortFoundEvent(device: Mobile.IDevice, data: IProjectDir): Promise<void> {
4040
const projectData = this.$projectDataService.getProjectData(data && data.projectDir);
4141
if (!this.canStartLookingForDebuggerPort(projectData)) {
4242
return;
@@ -45,7 +45,7 @@ export class IOSDebuggerPortService implements IIOSDebuggerPortService {
4545
this.attachToDebuggerPortFoundEventCore();
4646
this.attachToAttachRequestEvent(device);
4747

48-
this.$iOSLogParserService.startParsingLog(device, projectData);
48+
await this.$iOSLogParserService.startParsingLog(device, projectData);
4949
}
5050

5151
private canStartLookingForDebuggerPort(data: IProjectDir): boolean {

lib/services/ios-log-parser-service.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ export class IOSLogParserService extends EventEmitter implements IIOSLogParserSe
1313
super();
1414
}
1515

16-
public startParsingLog(device: Mobile.IDevice, data: IProjectName): void {
16+
public async startParsingLog(device: Mobile.IDevice, data: IProjectName): Promise<void> {
1717
this.$deviceLogProvider.setProjectNameForDevice(device.deviceInfo.identifier, data.projectName);
1818

1919
if (!this.startedDeviceLogInstances[device.deviceInfo.identifier]) {
2020
this.startParsingLogCore(device);
21-
this.startLogProcess(device);
21+
await this.startLogProcess(device);
2222
this.startedDeviceLogInstances[device.deviceInfo.identifier] = true;
2323
}
2424
}
@@ -41,7 +41,7 @@ export class IOSLogParserService extends EventEmitter implements IIOSLogParserSe
4141
}
4242
}
4343

44-
private startLogProcess(device: Mobile.IDevice): void {
44+
private async startLogProcess(device: Mobile.IDevice): Promise<void> {
4545
if (device.isEmulator) {
4646
return this.$iOSSimulatorLogProvider.startNewMutedLogProcess(device.deviceInfo.identifier);
4747
}

lib/services/livesync/android-livesync-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ export class AndroidLiveSyncService extends PlatformLiveSyncServiceBase implemen
1717
return service;
1818
}
1919

20-
public prepareForLiveSync(device: Mobile.IDevice, data: IProjectDir): void { /* */ }
20+
public async prepareForLiveSync(device: Mobile.IDevice, data: IProjectDir): Promise<void> { /* */ }
2121
}
2222
$injector.register("androidLiveSyncService", AndroidLiveSyncService);

lib/services/livesync/ios-livesync-service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ export class IOSLiveSyncService extends PlatformLiveSyncServiceBase implements I
6666
}
6767
}
6868

69-
public prepareForLiveSync(device: Mobile.IDevice, data: IProjectDir, liveSyncInfo: ILiveSyncInfo): void {
69+
public async prepareForLiveSync(device: Mobile.IDevice, data: IProjectDir, liveSyncInfo: ILiveSyncInfo): Promise<void> {
7070
if (!liveSyncInfo.skipWatcher) {
71-
this.$iOSDebuggerPortService.attachToDebuggerPortFoundEvent(device, data);
71+
return this.$iOSDebuggerPortService.attachToDebuggerPortFoundEvent(device, data);
7272
}
7373
}
7474

lib/services/livesync/livesync-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi
459459
const platformLiveSyncService = this.getLiveSyncService(platform);
460460
const deviceBuildInfoDescriptor = _.find(deviceDescriptors, dd => dd.identifier === device.deviceInfo.identifier);
461461

462-
platformLiveSyncService.prepareForLiveSync(device, projectData, liveSyncData);
462+
await platformLiveSyncService.prepareForLiveSync(device, projectData, liveSyncData);
463463

464464
await this.ensureLatestAppPackageIsInstalledOnDevice({
465465
device,

test/services/ios-debugger-port-service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ describe("iOSDebuggerPortService", () => {
148148

149149
_.each(testCases, testCase => {
150150
it(testCase.name, async () => {
151-
iOSDebuggerPortService.attachToDebuggerPortFoundEvent(device, mockProjectDirObj);
151+
await iOSDebuggerPortService.attachToDebuggerPortFoundEvent(device, mockProjectDirObj);
152152
if (testCase.emitStartingIOSApplicationEvent) {
153153
emitStartingIOSApplicationEvent();
154154
}
@@ -162,7 +162,7 @@ describe("iOSDebuggerPortService", () => {
162162
assert.deepEqual(port, testCase.emittedPort);
163163
});
164164
it(`${testCase.name} for multiline debugger port message.`, async () => {
165-
iOSDebuggerPortService.attachToDebuggerPortFoundEvent(device, mockProjectDirObj);
165+
await iOSDebuggerPortService.attachToDebuggerPortFoundEvent(device, mockProjectDirObj);
166166
if (testCase.emitStartingIOSApplicationEvent) {
167167
emitStartingIOSApplicationEvent();
168168
}

0 commit comments

Comments
 (0)