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
refactor: cancel() -> dispose() (#36065)
Simon Knotteb46532fcb76
diff --git a/packages/playwright/src/runner/watchMode.ts b/packages/playwright/src/runner/watchMode.tsindex 1c58a5fcef..d14d08d8b4 100644--- a/packages/playwright/src/runner/watchMode.ts+++ b/packages/playwright/src/runner/watchMode.ts@@ -151,7 +151,7 @@ export async function runWatchModeLoop(configLocation: ConfigLocation, initialOpwaitForCommand.result,]);if (command === 'changed')- waitForCommand.cancel();+ waitForCommand.dispose();if (bufferMode && command === 'changed')continue;@@ -267,7 +267,7 @@ export async function runWatchModeLoop(configLocation: ConfigLocation, initialOpreturn result === 'passed' ? teardown.status : result;}-function readKeyPress<T extends string>(handler: (text: string, key: any) => T | undefined): { cancel(): void; result: Promise<T> } {+function readKeyPress<T extends string>(handler: (text: string, key: any) => T | undefined): { dispose(): void; result: Promise<T> } {const promise = new ManualPromise<T>();const rl = readline.createInterface({ input: process.stdin, escapeCodeTimeout: 50 });@@ -281,16 +281,16 @@ function readKeyPress<T extends string>(handler: (text: string, key: any) => T |promise.resolve(result);});- const cancel = () => {+ const dispose = () => {eventsHelper.removeEventListeners([listener]);rl.close();if (process.stdin.isTTY)process.stdin.setRawMode(false);};- void promise.finally(cancel);+ void promise.finally(dispose);- return { result: promise, cancel };+ return { result: promise, dispose };}const isInterrupt = (text: string, key: any) => text === '\x03' || text === '\x1B' || (key && key.name === 'escape') || (key && key.ctrl && key.name === 'c');@@ -317,7 +317,7 @@ async function runTests(watchOptions: WatchModeOptions, testServerConnection: TereuseContext: connectWsEndpoint ? true : undefined,workers: connectWsEndpoint ? 1 : undefined,headed: connectWsEndpoint ? true : undefined,- }).finally(() => waitForDone.cancel());+ }).finally(() => waitForDone.dispose());}function readCommand() {