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 * as reporterTypes from '../../types/testReporter';
|
||||||
import type { ReporterV2 } from '../reporters/reporterV2';
|
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 StringIntern = (s: string) => string;
|
||||||
export type JsonLocation = reporterTypes.Location;
|
export type JsonLocation = reporterTypes.Location;
|
||||||
export type JsonError = string;
|
export type JsonError = string;
|
||||||
|
|
@ -613,7 +611,7 @@ export function serializeRegexPatterns(patterns: string | RegExp | (string | Reg
|
||||||
|
|
||||||
export function parseRegexPatterns(patterns: JsonPattern[]): (string | RegExp)[] {
|
export function parseRegexPatterns(patterns: JsonPattern[]): (string | RegExp)[] {
|
||||||
return patterns.map(p => {
|
return patterns.map(p => {
|
||||||
if (p.s)
|
if (p.s !== undefined)
|
||||||
return p.s;
|
return p.s;
|
||||||
return new RegExp(p.r!.source, p.r!.flags);
|
return new RegExp(p.r!.source, p.r!.flags);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ export class TestServerConnection implements TestServerInterface, TestServerInte
|
||||||
private _ws: WebSocket;
|
private _ws: WebSocket;
|
||||||
private _callbacks = new Map<number, { resolve: (arg: any) => void, reject: (arg: Error) => void }>();
|
private _callbacks = new Map<number, { resolve: (arg: any) => void, reject: (arg: Error) => void }>();
|
||||||
private _connectedPromise: Promise<void>;
|
private _connectedPromise: Promise<void>;
|
||||||
|
private _isClosed = false;
|
||||||
|
|
||||||
constructor(wsURL: string) {
|
constructor(wsURL: string) {
|
||||||
this.onClose = this._onCloseEmitter.event;
|
this.onClose = this._onCloseEmitter.event;
|
||||||
|
|
@ -70,11 +71,16 @@ export class TestServerConnection implements TestServerInterface, TestServerInte
|
||||||
this._ws.addEventListener('error', r);
|
this._ws.addEventListener('error', r);
|
||||||
});
|
});
|
||||||
this._ws.addEventListener('close', () => {
|
this._ws.addEventListener('close', () => {
|
||||||
|
this._isClosed = true;
|
||||||
this._onCloseEmitter.fire();
|
this._onCloseEmitter.fire();
|
||||||
clearInterval(pingInterval);
|
clearInterval(pingInterval);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isClosed(): boolean {
|
||||||
|
return this._isClosed;
|
||||||
|
}
|
||||||
|
|
||||||
private async _sendMessage(method: string, params?: any): Promise<any> {
|
private async _sendMessage(method: string, params?: any): Promise<any> {
|
||||||
const logForTest = (globalThis as any).__logForTest;
|
const logForTest = (globalThis as any).__logForTest;
|
||||||
logForTest?.({ method, params });
|
logForTest?.({ method, params });
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,6 @@ import type * as teleReceiver from '../isomorphic/teleReceiver';
|
||||||
import { serializeRegexPatterns } from '../isomorphic/teleReceiver';
|
import { serializeRegexPatterns } from '../isomorphic/teleReceiver';
|
||||||
import type { ReporterV2 } from './reporterV2';
|
import type { ReporterV2 } from './reporterV2';
|
||||||
|
|
||||||
// -- Reuse boundary -- Everything below this line is reused in the vscode extension.
|
|
||||||
|
|
||||||
export type TeleReporterEmitterOptions = {
|
export type TeleReporterEmitterOptions = {
|
||||||
omitOutput?: boolean;
|
omitOutput?: boolean;
|
||||||
omitBuffers?: boolean;
|
omitBuffers?: boolean;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue