test: puppeteer.connect with using disconnects the browser (#12371)

This commit is contained in:
Nikolay Vitkov
2024-05-02 09:22:06 +02:00
committed by GitHub
parent b5aab04cbc
commit dfb31f3e92
10 changed files with 47 additions and 39 deletions

View File

@@ -424,12 +424,18 @@ export abstract class Browser extends EventEmitter<BrowserEvents> {
/** @internal */
[disposeSymbol](): void {
return void this.close().catch(debugError);
if (this.process()) {
return void this.close().catch(debugError);
}
return void this.disconnect().catch(debugError);
}
/** @internal */
[asyncDisposeSymbol](): Promise<void> {
return this.close();
if (this.process()) {
return this.close();
}
return this.disconnect();
}
/**

View File

@@ -197,7 +197,7 @@ export class TestServer {
this.#requestSubscribers.clear();
for (const request of this.#requests.values()) {
if (!request.writableEnded) {
request.end();
request.destroy();
}
}
this.#requests.clear();