Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach committed Jul 1, 2024
1 parent 60ffe0d commit f32091b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 19 deletions.
4 changes: 2 additions & 2 deletions lib/commands/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,12 +569,12 @@ const commands = {
if (name && name !== NATIVE_WIN && this.logs) {
if (this.logs.safariConsole) {
await this.remote.startConsole(
this.logs.safariConsole.addLogLine.bind(this.logs.safariConsole),
this.logs.safariConsole.onConsoleLogEvent.bind(this.logs.safariConsole),
);
}
if (this.logs.safariNetwork) {
await this.remote.startNetwork(
this.logs.safariNetwork.addLogLine.bind(this.logs.safariNetwork),
this.logs.safariNetwork.onNetworkEvent.bind(this.logs.safariNetwork),
);
}
}
Expand Down
2 changes: 0 additions & 2 deletions lib/commands/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ export default {
}
})(),
this.logs.crashlog.startCapture(),
this.logs.safariConsole.startCapture(),
this.logs.safariNetwork.startCapture(),
];
await B.all(promises);

Expand Down
26 changes: 13 additions & 13 deletions lib/device-log/ios-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,6 @@ export abstract class IOSLog<
return this._log;
}

broadcast(entry: TRawEntry): void {
let recentIndex = -1;
for (const key of this.logs.rkeys()) {
recentIndex = key;
break;
}
const serializedEntry = this._serializeEntry(entry);
this.logs.set(++recentIndex, serializedEntry);
if (this.listenerCount('output')) {
this.emit('output', this._deserializeEntry(serializedEntry));
}
}

getLogs(): LogEntry[] {
const result: LogEntry[] = [];
let recentLogIndex: number | null = null;
Expand Down Expand Up @@ -82,6 +69,19 @@ export abstract class IOSLog<
protected _clearEntries() {
this.logs.clear();
}

protected broadcast(entry: TRawEntry): void {
let recentIndex = -1;
for (const key of this.logs.rkeys()) {
recentIndex = key;
break;
}
const serializedEntry = this._serializeEntry(entry);
this.logs.set(++recentIndex, serializedEntry);
if (this.listenerCount('output')) {
this.emit('output', this._deserializeEntry(serializedEntry));
}
}
}

export default IOSLog;
2 changes: 1 addition & 1 deletion lib/device-log/safari-console-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class SafariConsoleLog extends LineConsumingLog {
* object, stringified.
*
*/
addLogLine(err: Error | null, entry: SafariConsoleEntry): void {
onConsoleLogEvent(err: object | null, entry: SafariConsoleEntry): void {
const serializedEntry = JSON.stringify(entry);
this.broadcast(serializedEntry);
this.log.info(`[SafariConsole] ${_.truncate(serializedEntry)}`);
Expand Down
2 changes: 1 addition & 1 deletion lib/device-log/safari-network-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class SafariNetworkLog extends LineConsumingLog {
return true;
}

addLogLine(method: string, entry: SafariNetworkLogEntry): void {
onNetworkEvent(method: string, entry: SafariNetworkLogEntry): void {
if (!MONITORED_EVENTS.includes(method)) {
return;
}
Expand Down

0 comments on commit f32091b

Please sign in to comment.