mirror of
https://github.com/microsoft/playwright.git
synced 2024-11-28 09:23:42 +03:00
chore: allow empty string in regex patterns (#31804)
This commit is contained in:
parent
d87cb7a303
commit
cf1a313a0c
@ -19,8 +19,6 @@ import type { Metadata } from '../../types/test';
|
||||
import type * as reporterTypes from '../../types/testReporter';
|
||||
import type { ReporterV2 } from '../reporters/reporterV2';
|
||||
|
||||
// -- Reuse boundary -- Everything below this line is reused in the vscode extension.
|
||||
|
||||
export type StringIntern = (s: string) => string;
|
||||
export type JsonLocation = reporterTypes.Location;
|
||||
export type JsonError = string;
|
||||
@ -613,7 +611,7 @@ export function serializeRegexPatterns(patterns: string | RegExp | (string | Reg
|
||||
|
||||
export function parseRegexPatterns(patterns: JsonPattern[]): (string | RegExp)[] {
|
||||
return patterns.map(p => {
|
||||
if (p.s)
|
||||
if (p.s !== undefined)
|
||||
return p.s;
|
||||
return new RegExp(p.r!.source, p.r!.flags);
|
||||
});
|
||||
|
@ -38,6 +38,7 @@ export class TestServerConnection implements TestServerInterface, TestServerInte
|
||||
private _ws: WebSocket;
|
||||
private _callbacks = new Map<number, { resolve: (arg: any) => void, reject: (arg: Error) => void }>();
|
||||
private _connectedPromise: Promise<void>;
|
||||
private _isClosed = false;
|
||||
|
||||
constructor(wsURL: string) {
|
||||
this.onClose = this._onCloseEmitter.event;
|
||||
@ -70,11 +71,16 @@ export class TestServerConnection implements TestServerInterface, TestServerInte
|
||||
this._ws.addEventListener('error', r);
|
||||
});
|
||||
this._ws.addEventListener('close', () => {
|
||||
this._isClosed = true;
|
||||
this._onCloseEmitter.fire();
|
||||
clearInterval(pingInterval);
|
||||
});
|
||||
}
|
||||
|
||||
isClosed(): boolean {
|
||||
return this._isClosed;
|
||||
}
|
||||
|
||||
private async _sendMessage(method: string, params?: any): Promise<any> {
|
||||
const logForTest = (globalThis as any).__logForTest;
|
||||
logForTest?.({ method, params });
|
||||
|
@ -21,8 +21,6 @@ import type * as teleReceiver from '../isomorphic/teleReceiver';
|
||||
import { serializeRegexPatterns } from '../isomorphic/teleReceiver';
|
||||
import type { ReporterV2 } from './reporterV2';
|
||||
|
||||
// -- Reuse boundary -- Everything below this line is reused in the vscode extension.
|
||||
|
||||
export type TeleReporterEmitterOptions = {
|
||||
omitOutput?: boolean;
|
||||
omitBuffers?: boolean;
|
||||
|
Loading…
Reference in New Issue
Block a user