Skip to content

Commit 13dbab0

Browse files
authored
Merge pull request #274 from ringcentral/WAT-5677
WAT-5677
2 parents feb444f + 1c15531 commit 13dbab0

4 files changed

Lines changed: 15 additions & 8 deletions

File tree

core/logger/src/logger-server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class LoggerServer extends PluggableModule implements ILoggerServer {
5656
): Promise<void> {
5757
const queueItem = this.queue.shift();
5858

59-
if (queueItem === undefined) {
59+
if (!queueItem) {
6060
this.status = LogQueueStatus.EMPTY;
6161
return;
6262
}

core/types/src/utils/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export interface IStack<T> {
1313
export interface IQueue<T> {
1414
push(...elements: Array<T>): void;
1515

16-
shift(): T | void;
16+
shift(): T | undefined;
1717

1818
clean(): void;
1919

core/utils/src/queue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class Queue<T> implements IQueue<T> {
1515
this.array.push(...elements);
1616
}
1717

18-
public shift(): T | void {
18+
public shift(): T | undefined {
1919
return this.array.shift();
2020
}
2121

packages/web-application/src/web-application.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
XpathSelector,
2020
ShadowCssSelector,
2121
Selector,
22+
isXpathSelector,
2223
} from '@testring/types';
2324

2425
import {asyncBreakpoints} from '@testring/async-breakpoints';
@@ -225,12 +226,18 @@ export class WebApplication extends PluggableModule {
225226

226227
if (this.config.devtool) {
227228
try {
228-
if (normalizedXPath && normalizedXPath.type !== 'xpath') {
229-
throw new Error(
230-
`devtoolHighlight only supports xpath selectors. Received type: ${normalizedXPath.type}, value: ${JSON.stringify(normalizedXPath)}`
231-
);
229+
let xpathString: string | null = null;
230+
231+
if (normalizedXPath) {
232+
if (!isXpathSelector(normalizedXPath)) {
233+
throw new Error(
234+
`devtoolHighlight only supports xpath selectors. Received type: ${normalizedXPath.type}, value: ${JSON.stringify(normalizedXPath)}`
235+
);
236+
}
237+
238+
xpathString = normalizedXPath.xpath;
232239
}
233-
const xpathString = normalizedXPath ? normalizedXPath.xpath : null;
240+
234241
await this.client.execute((addHighlightXpath: string) => {
235242
window.postMessage(
236243
{

0 commit comments

Comments
 (0)