Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: enforce dispatcher API convention for server types (2) (#40020)
Pavel Feldman9d81a6754d94
diff --git a/packages/playwright-core/src/server/artifact.ts b/packages/playwright-core/src/server/artifact.tsindex 9e8b4d0c11..51c341b361 100644--- a/packages/playwright-core/src/server/artifact.ts+++ b/packages/playwright-core/src/server/artifact.ts@@ -21,6 +21,8 @@ import { TargetClosedError } from './errors';import { SdkObject } from './instrumentation';import { ManualPromise } from '../utils/isomorphic/manualPromise';+import type { Progress } from '@protocol/progress';+type SaveCallback = (localPath: string, error?: Error) => Promise<void>;type CancelCallback = () => Promise<void>;@@ -32,7 +34,7 @@ export class Artifact extends SdkObject {private _saveCallbacks: SaveCallback[] = [];private _finished: boolean = false;private _deleted = false;- private _failureError: Error | undefined;+ private _failureErrorValue: Error | undefined;constructor(parent: SdkObject, localPath: string, unaccessibleErrorMessage?: string, cancelCallback?: CancelCallback) {super(parent, 'artifact');@@ -41,26 +43,42 @@ export class Artifact extends SdkObject {this._cancelCallback = cancelCallback;}+ async localPathAfterFinished(progress: Progress): Promise<string> {+ return await progress.race(this._localPathAfterFinished());+ }++ async failureError(progress: Progress): Promise<string | null> {+ return await progress.race(this._failureError());+ }++ async cancel(progress: Progress): Promise<void> {+ return await progress.race(this._cancel());+ }++ async delete(progress: Progress): Promise<void> {+ return await progress.race(this._delete());+ }+localPath() {return this._localPath;}- async localPathAfterFinished(): Promise<string> {+ private async _localPathAfterFinished(): Promise<string> {if (this._unaccessibleErrorMessage)throw new Error(this._unaccessibleErrorMessage);await this._finishedPromise;- if (this._failureError)- throw this._failureError;+ if (this._failureErrorValue)+ throw this._failureErrorValue;return this._localPath;}- saveAs(saveCallback: SaveCallback) {+ saveAs(progress: Progress, saveCallback: SaveCallback) {if (this._unaccessibleErrorMessage)throw new Error(this._unaccessibleErrorMessage);if (this._deleted)throw new Error(`File already deleted. Save before deleting.`);- if (this._failureError)- throw this._failureError;+ if (this._failureErrorValue)+ throw this._failureErrorValue;if (this._finished) {saveCallback(this._localPath).catch(() => {});@@ -69,22 +87,22 @@ export class Artifact extends SdkObject {this._saveCallbacks.push(saveCallback);}- async failureError(): Promise<string | null> {+ async _failureError(): Promise<string | null> {if (this._unaccessibleErrorMessage)return this._unaccessibleErrorMessage;await this._finishedPromise;- return this._failureError?.message || null;+ return this._failureErrorValue?.message || null;}- async cancel(): Promise<void> {+ async _cancel(): Promise<void> {assert(this._cancelCallback !== undefined);return this._cancelCallback();}- async delete(): Promise<void> {+ async _delete(): Promise<void> {if (this._unaccessibleErrorMessage)return;- const fileName = await this.localPathAfterFinished();+ const fileName = await this._localPathAfterFinished();if (this._deleted)return;this._deleted = true;@@ -107,7 +125,7 @@ export class Artifact extends SdkObject {if (this._finished)return;this._finished = true;- this._failureError = error;+ this._failureErrorValue = error;if (error) {for (const callback of this._saveCallbacks)diff --git a/packages/playwright-core/src/server/chromium/crConnection.ts b/packages/playwright-core/src/server/chromium/crConnection.tsindex 8df1f61347..d85a6b41ca 100644--- a/packages/playwright-core/src/server/chromium/crConnection.ts+++ b/packages/playwright-core/src/server/chromium/crConnection.ts@@ -26,6 +26,7 @@ import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../import type { Protocol } from './protocol';import type { RecentLogsCollector } from '../utils/debugLogger';import type { ProtocolLogger } from '../types';+import type { Progress } from '@protocol/progress';export const ConnectionEvents = {@@ -213,16 +214,20 @@ export class CDPSession extends SdkObject {})];}- async send(method: string, params?: any) {- return await this._session.send(method as any, params);+ async send(progress: Progress, method: string, params?: any) {+ return await progress.race(this._send(method, params));}- async detach() {- return await this._session.detach();+ async detach(progress: Progress) {+ return await progress.race(this._session.detach());+ }++ private async _send(method: string, params?: any) {+ return await this._session.send(method as any, params);}async attachToTarget(targetId: string) {- const { sessionId } = await this.send('Target.attachToTarget', { targetId, flatten: true });+ const { sessionId } = await this._send('Target.attachToTarget', { targetId, flatten: true });return new CDPSession(this._session, sessionId);}diff --git a/packages/playwright-core/src/server/debugController.ts b/packages/playwright-core/src/server/debugController.tsindex 26858e3c07..ef4230c6e8 100644--- a/packages/playwright-core/src/server/debugController.ts+++ b/packages/playwright-core/src/server/debugController.ts@@ -52,15 +52,19 @@ export class DebugController extends SdkObject {this._playwright = playwright;}- initialize(codegenId: string, sdkLanguage: Language) {+ initialize(progress: Progress, codegenId: string, sdkLanguage: Language) {this._sdkLanguage = sdkLanguage;}dispose() {- this.setReportStateChanged(false);+ this._setReportStateChanged(false);}- setReportStateChanged(enabled: boolean) {+ setReportStateChanged(progress: Progress, enabled: boolean) {+ this._setReportStateChanged(enabled);+ }++ private _setReportStateChanged(enabled: boolean) {if (enabled && !this._trackHierarchyListener) {this._trackHierarchyListener = {onPageOpen: () => this._emitSnapshot(false),@@ -139,7 +143,7 @@ export class DebugController extends SdkObject {recorder.resume();}- kill() {+ kill(progress: Progress) {gracefullyProcessExitDoNotHang(0);}diff --git a/packages/playwright-core/src/server/debugger.ts b/packages/playwright-core/src/server/debugger.tsindex 0e20b61c5c..f48eb270d2 100644--- a/packages/playwright-core/src/server/debugger.ts+++ b/packages/playwright-core/src/server/debugger.ts@@ -20,6 +20,7 @@ import { BrowserContext } from './browserContext';import { getMetainfo } from '../utils/isomorphic/protocolMetainfo';import type { CallMetadata, InstrumentationListener } from './instrumentation';+import type { Progress } from '@protocol/progress';const symbol = Symbol('Debugger');@@ -47,6 +48,35 @@ export class Debugger extends SdkObject implements InstrumentationListener {});}+ requestPause(progress: Progress) {+ if (this.isPaused())+ throw new Error('Debugger is already paused');+ this.setPauseBeforeWaitingActions();+ this.setPauseAt({ next: true });+ }++ doResume(progress: Progress) {+ if (!this.isPaused())+ throw new Error('Debugger is not paused');+ this.resume();+ }++ next(progress: Progress) {+ if (!this.isPaused())+ throw new Error('Debugger is not paused');+ this.setPauseBeforeWaitingActions();+ this.setPauseAt({ next: true });+ this.resume();+ }++ runTo(progress: Progress, location: { file: string, line?: number, column?: number }) {+ if (!this.isPaused())+ throw new Error('Debugger is not paused');+ this.setPauseBeforeWaitingActions();+ this.setPauseAt({ location });+ this.resume();+ }+async setMuted(muted: boolean) {this._muted = muted;}diff --git a/packages/playwright-core/src/server/dispatchers/artifactDispatcher.ts b/packages/playwright-core/src/server/dispatchers/artifactDispatcher.tsindex 6ccfc1b5a6..5dd09c9121 100644--- a/packages/playwright-core/src/server/dispatchers/artifactDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/artifactDispatcher.ts@@ -46,13 +46,13 @@ export class ArtifactDispatcher extends Dispatcher<Artifact, channels.ArtifactCh}async pathAfterFinished(params: channels.ArtifactPathAfterFinishedParams, progress: Progress): Promise<channels.ArtifactPathAfterFinishedResult> {- const path = await progress.race(this._object.localPathAfterFinished());+ const path = await this._object.localPathAfterFinished(progress);return { value: path };}async saveAs(params: channels.ArtifactSaveAsParams, progress: Progress): Promise<channels.ArtifactSaveAsResult> {return await progress.race(new Promise((resolve, reject) => {- this._object.saveAs(async (localPath, error) => {+ this._object.saveAs(progress, async (localPath, error) => {if (error) {reject(error);return;@@ -70,7 +70,7 @@ export class ArtifactDispatcher extends Dispatcher<Artifact, channels.ArtifactChasync saveAsStream(params: channels.ArtifactSaveAsStreamParams, progress: Progress): Promise<channels.ArtifactSaveAsStreamResult> {return await progress.race(new Promise((resolve, reject) => {- this._object.saveAs(async (localPath, error) => {+ this._object.saveAs(progress, async (localPath, error) => {if (error) {reject(error);return;@@ -94,23 +94,23 @@ export class ArtifactDispatcher extends Dispatcher<Artifact, channels.ArtifactCh}async stream(params: channels.ArtifactStreamParams, progress: Progress): Promise<channels.ArtifactStreamResult> {- const fileName = await progress.race(this._object.localPathAfterFinished());+ const fileName = await this._object.localPathAfterFinished(progress);const readable = fs.createReadStream(fileName, { highWaterMark: 1024 * 1024 });return { stream: new StreamDispatcher(this, readable) };}async failure(params: channels.ArtifactFailureParams, progress: Progress): Promise<channels.ArtifactFailureResult> {- const error = await progress.race(this._object.failureError());+ const error = await this._object.failureError(progress);return { error: error || undefined };}async cancel(params: channels.ArtifactCancelParams, progress: Progress): Promise<void> {- await progress.race(this._object.cancel());+ await this._object.cancel(progress);}async delete(params: channels.ArtifactDeleteParams, progress: Progress): Promise<void> {progress.metadata.potentiallyClosesScope = true;- await progress.race(this._object.delete());+ await this._object.delete(progress);this._dispose();}}diff --git a/packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.ts b/packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.tsindex 42e60e28fe..70da4144a2 100644--- a/packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.ts@@ -35,11 +35,11 @@ export class CDPSessionDispatcher extends Dispatcher<CDPSession, channels.CDPSes}async send(params: channels.CDPSessionSendParams, progress: Progress): Promise<channels.CDPSessionSendResult> {- return { result: await progress.race(this._object.send(params.method as any, params.params)) };+ return { result: await this._object.send(progress, params.method as any, params.params) };}async detach(_: any, progress: Progress): Promise<void> {progress.metadata.potentiallyClosesScope = true;- await this._object.detach();+ await this._object.detach(progress);}}diff --git a/packages/playwright-core/src/server/dispatchers/debugControllerDispatcher.ts b/packages/playwright-core/src/server/dispatchers/debugControllerDispatcher.tsindex d5df7c9323..4ca9365d5e 100644--- a/packages/playwright-core/src/server/dispatchers/debugControllerDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/debugControllerDispatcher.ts@@ -51,11 +51,11 @@ export class DebugControllerDispatcher extends Dispatcher<DebugController, chann}async initialize(params: channels.DebugControllerInitializeParams, progress: Progress) {- this._object.initialize(params.codegenId, params.sdkLanguage);+ this._object.initialize(progress, params.codegenId, params.sdkLanguage);}async setReportStateChanged(params: channels.DebugControllerSetReportStateChangedParams, progress: Progress) {- this._object.setReportStateChanged(params.enabled);+ this._object.setReportStateChanged(progress, params.enabled);}async setRecorderMode(params: channels.DebugControllerSetRecorderModeParams, progress: Progress) {@@ -75,7 +75,7 @@ export class DebugControllerDispatcher extends Dispatcher<DebugController, chann}async kill(params: channels.DebugControllerKillParams, progress: Progress) {- this._object.kill();+ this._object.kill(progress);}override _onDispose() {diff --git a/packages/playwright-core/src/server/dispatchers/debuggerDispatcher.ts b/packages/playwright-core/src/server/dispatchers/debuggerDispatcher.tsindex 9b8ad67137..bf622c7930 100644--- a/packages/playwright-core/src/server/dispatchers/debuggerDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/debuggerDispatcher.ts@@ -55,31 +55,18 @@ export class DebuggerDispatcher extends Dispatcher<Debugger, channels.DebuggerCh}async requestPause(params: channels.DebuggerRequestPauseParams, progress: Progress): Promise<void> {- if (this._object.isPaused())- throw new Error('Debugger is already paused');- this._object.setPauseBeforeWaitingActions();- this._object.setPauseAt({ next: true });+ this._object.requestPause(progress);}async resume(params: channels.DebuggerResumeParams, progress: Progress): Promise<void> {- if (!this._object.isPaused())- throw new Error('Debugger is not paused');- this._object.resume();+ this._object.doResume(progress);}async next(params: channels.DebuggerNextParams, progress: Progress): Promise<void> {- if (!this._object.isPaused())- throw new Error('Debugger is not paused');- this._object.setPauseBeforeWaitingActions();- this._object.setPauseAt({ next: true });- this._object.resume();+ this._object.next(progress);}async runTo(params: channels.DebuggerRunToParams, progress: Progress): Promise<void> {- if (!this._object.isPaused())- throw new Error('Debugger is not paused');- this._object.setPauseBeforeWaitingActions();- this._object.setPauseAt({ location: params.location });- this._object.resume();+ this._object.runTo(progress, params.location);}}diff --git a/packages/playwright-core/src/server/dispatchers/electronDispatcher.ts b/packages/playwright-core/src/server/dispatchers/electronDispatcher.tsindex 3ef174d6b0..4dcf68d0d1 100644--- a/packages/playwright-core/src/server/dispatchers/electronDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/electronDispatcher.ts@@ -71,7 +71,7 @@ export class ElectronApplicationDispatcher extends Dispatcher<ElectronApplicatio}async browserWindow(params: channels.ElectronApplicationBrowserWindowParams, progress: Progress): Promise<channels.ElectronApplicationBrowserWindowResult> {- const handle = await progress.race(this._object.browserWindow((params.page as PageDispatcher).page()));+ const handle = await this._object.browserWindow(progress, (params.page as PageDispatcher).page());return { handle: JSHandleDispatcher.fromJSHandle(this, handle) };}diff --git a/packages/playwright-core/src/server/dispatchers/tracingDispatcher.ts b/packages/playwright-core/src/server/dispatchers/tracingDispatcher.tsindex 0c123d4e4a..68c201d9cb 100644--- a/packages/playwright-core/src/server/dispatchers/tracingDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/tracingDispatcher.ts@@ -16,6 +16,7 @@import { ArtifactDispatcher } from './artifactDispatcher';import { Dispatcher } from './dispatcher';+import { nullProgress } from '../progress';import type { BrowserContextDispatcher } from './browserContextDispatcher';import type { APIRequestContextDispatcher } from './networkDispatchers';@@ -37,7 +38,7 @@ export class TracingDispatcher extends Dispatcher<Tracing, channels.TracingChann}async tracingStart(params: channels.TracingTracingStartParams, progress: Progress): Promise<channels.TracingTracingStartResult> {- this._object.start(params);+ this._object.start(progress, params);this._started = true;}@@ -47,11 +48,11 @@ export class TracingDispatcher extends Dispatcher<Tracing, channels.TracingChannasync tracingGroup(params: channels.TracingTracingGroupParams, progress: Progress): Promise<channels.TracingTracingGroupResult> {const { name, location } = params;- this._object.group(name, location, progress.metadata);+ this._object.group(progress, name, location);}async tracingGroupEnd(params: channels.TracingTracingGroupEndParams, progress: Progress): Promise<channels.TracingTracingGroupEndResult> {- this._object.groupEnd();+ this._object.groupEnd(progress);}async tracingStopChunk(params: channels.TracingTracingStopChunkParams, progress: Progress): Promise<channels.TracingTracingStopChunkResult> {@@ -67,7 +68,7 @@ export class TracingDispatcher extends Dispatcher<Tracing, channels.TracingChannoverride _onDispose() {// Avoid protocol calls for the closed context.if (this._started)- this._object.stopChunk(undefined, { mode: 'discard' }).then(() => this._object.stop(undefined)).catch(() => {});+ this._object.stopChunk(nullProgress, { mode: 'discard' }).then(() => this._object.stop(nullProgress)).catch(() => {});this._started = false;}}diff --git a/packages/playwright-core/src/server/electron/electron.ts b/packages/playwright-core/src/server/electron/electron.tsindex 6afbb1f640..e486366c62 100644--- a/packages/playwright-core/src/server/electron/electron.ts+++ b/packages/playwright-core/src/server/electron/electron.ts@@ -136,7 +136,7 @@ export class ElectronApplication extends SdkObject {await this._browserContext.close({ reason: 'Application exited' });}- async browserWindow(page: Page): Promise<js.JSHandle<BrowserWindow>> {+ async browserWindow(progress: Progress, page: Page): Promise<js.JSHandle<BrowserWindow>> {// Assume CRPage as Electron is always Chromium.const targetId = (page.delegate as CRPage)._targetId;const electronHandle = await this._nodeElectronHandlePromise;diff --git a/packages/playwright-core/src/server/javascript.ts b/packages/playwright-core/src/server/javascript.tsindex bc22454375..950f9d0f9e 100644--- a/packages/playwright-core/src/server/javascript.ts+++ b/packages/playwright-core/src/server/javascript.ts@@ -143,11 +143,11 @@ export class JSHandle<T = any> extends SdkObject {}async evaluateExpressionHandle(progress: Progress, expression: string, options: { isFunction?: boolean }, arg: any): Promise<JSHandle<any>> {- return await progress.race(this.internalEvaluateExpressionHandle(expression, options, arg));+ return await progress.race(this._evaluateExpressionHandle(expression, options, arg));}async getProperty(progress: Progress, propertyName: string): Promise<JSHandle> {- return await progress.race(this.internalGetProperty(propertyName));+ return await progress.race(this._getProperty(propertyName));}async getProperties(progress: Progress): Promise<Map<string, JSHandle>> {@@ -155,7 +155,7 @@ export class JSHandle<T = any> extends SdkObject {}async jsonValue(progress: Progress): Promise<T> {- return await progress.race(this.internalJsonValue());+ return await progress.race(this._jsonValue());}async evaluate<R, Arg>(pageFunction: FuncOn<T, Arg, R>, arg?: Arg): Promise<R> {@@ -170,11 +170,11 @@ export class JSHandle<T = any> extends SdkObject {return await evaluateExpression(this._context, expression, { ...options, returnByValue: true }, this, arg);}- async internalEvaluateExpressionHandle(expression: string, options: { isFunction?: boolean }, arg: any): Promise<JSHandle<any>> {+ private async _evaluateExpressionHandle(expression: string, options: { isFunction?: boolean }, arg: any): Promise<JSHandle<any>> {return await evaluateExpression(this._context, expression, { ...options, returnByValue: false }, this, arg);}- async internalGetProperty(propertyName: string): Promise<JSHandle> {+ private async _getProperty(propertyName: string): Promise<JSHandle> {const objectHandle = await this.evaluateHandle((object: any, propertyName) => {const result: any = { __proto__: null };result[propertyName] = object[propertyName];@@ -196,7 +196,7 @@ export class JSHandle<T = any> extends SdkObject {return this._value;}- async internalJsonValue(): Promise<T> {+ private async _jsonValue(): Promise<T> {if (!this._objectId)return this._value;const script = `(utilityScript, ...args) => utilityScript.jsonValue(...args)`;diff --git a/packages/playwright-core/src/server/progress.ts b/packages/playwright-core/src/server/progress.tsindex 713dcc0cea..132dfe0581 100644--- a/packages/playwright-core/src/server/progress.ts+++ b/packages/playwright-core/src/server/progress.ts@@ -144,3 +144,26 @@ export async function raceUncancellableOperationWithCleanup<T>(progress: Progresthrow error;}}++export const nullProgress: Progress = {+ timeout: 0,+ deadline: 0,+ disableTimeout() { },+ log() { },+ race<T>(promise: Promise<T> | Promise<T>[]) {+ const promises = Array.isArray(promise) ? promise : [promise];+ return Promise.race(promises);+ },+ wait: async (timeout: number) => await new Promise<void>(f => setTimeout(f, timeout)),+ signal: new AbortController().signal,+ metadata: {+ id: '',+ startTime: 0,+ endTime: 0,+ type: '',+ method: '',+ params: {},+ log: [],+ internal: true,+ }+};diff --git a/packages/playwright-core/src/server/trace/recorder/tracing.ts b/packages/playwright-core/src/server/trace/recorder/tracing.tsindex 7b0239d533..38e5aa1556 100644--- a/packages/playwright-core/src/server/trace/recorder/tracing.ts+++ b/packages/playwright-core/src/server/trace/recorder/tracing.ts@@ -135,12 +135,12 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snapsasync resetForReuse(progress: Progress) {// Discard previous chunk if any and ignore any errors there.await this.stopChunk(progress, { mode: 'discard' }).catch(() => {});- await this.stop(progress);+ await this._stop();if (this._snapshotter)await progress.race(this._snapshotter.resetForReuse());}- start(options: TracerOptions) {+ start(progress: Progress, options: TracerOptions) {if (this._isStopping)throw new Error('Cannot start tracing while stopping');if (this._state)@@ -225,9 +225,10 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snapsreturn this._state?.groupStack.length ? this._state.groupStack[this._state.groupStack.length - 1] : undefined;}- group(name: string, location: { file: string, line?: number, column?: number } | undefined, metadata: CallMetadata) {+ group(progress: Progress, name: string, location: { file: string, line?: number, column?: number } | undefined) {if (!this._state)return;+ const metadata = progress.metadata;const stackFrames: StackFrame[] = [];const { file, line, column } = location ?? metadata.location ?? {};if (file) {@@ -254,7 +255,11 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snapsthis._appendTraceEvent(event);}- groupEnd() {+ groupEnd(progress: Progress) {+ this._groupEnd();+ }++ private _groupEnd() {if (!this._state)return;const callId = this._state.groupStack.pop();@@ -302,7 +307,11 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snapsstate.networkFile = newNetworkFile;}- async stop(progress: Progress | undefined) {+ async stop(progress: Progress) {+ await progress.race(this._stop());+ }++ private async _stop() {if (!this._state)return;if (this._isStopping)@@ -312,8 +321,7 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snapsthis._closeAllGroups();this._harTracer.stop();this.flushHarEntries();- const promise = progress ? progress.race(this._fs.syncAndGetError()) : this._fs.syncAndGetError();- await promise.finally(() => {+ await this._fs.syncAndGetError().finally(() => {this._state = undefined;});}@@ -342,10 +350,10 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snapsprivate _closeAllGroups() {while (this._currentGroupId())- this.groupEnd();+ this._groupEnd();}- async stopChunk(progress: Progress | undefined, params: TracingTracingStopChunkParams): Promise<{ artifact?: Artifact, entries?: NameValue[] }> {+ async stopChunk(progress: Progress, params: TracingTracingStopChunkParams): Promise<{ artifact?: Artifact, entries?: NameValue[] }> {if (this._isStopping)throw new Error(`Tracing is already stopping`);this._isStopping = true;@@ -399,7 +407,7 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snapsthis._fs.zip(entries, zipFileName);// Make sure all file operations complete.- const promise = progress ? progress.race(this._fs.syncAndGetError()) : this._fs.syncAndGetError();+ const promise = progress.race(this._fs.syncAndGetError());const error = await promise.catch(e => e);this._isStopping = false;