Quantcast
Channel: Recent Gists from badsyntax
Viewing all articles
Browse latest Browse all 37

playwright not ending tests

$
0
0
playwright.patch
diff --git a/node_modules/playwright/lib/runner/processHost.js b/node_modules/playwright/lib/runner/processHost.js
index a8ee4e7..8ce01c5 100644
--- a/node_modules/playwright/lib/runner/processHost.js
+++ b/node_modules/playwright/lib/runner/processHost.js
@@ -140,8 +140,20 @@ class ProcessHost extends import_events.EventEmitter {
this.send({ method: "__stop__" });
this._didSendStop = true;
}
- if (!this._didExitAndRanOnExit)
- await new Promise((f) => this.once("exit", f));
+ if (!this._didExitAndRanOnExit) {
+ // Add timeout to force kill if process doesn't exit
+ const exitPromise = new Promise((f) => this.once("exit", f));
+ const timeoutPromise = new Promise((resolve) => {
+ setTimeout(() => {
+ if (this.process && !this._processDidExit) {
+ console.log(`Force killing process ${this._processName} after 5s timeout`);
+ this.process.kill('SIGKILL');
+ }
+ resolve();
+ }, 5000);
+ });
+ await Promise.race([exitPromise, timeoutPromise]);
+ }
}
didSendStop() {
return this._didSendStop;

Viewing all articles
Browse latest Browse all 37

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>