From 679f725e02399a1afe968464c61709d3c546cb01 Mon Sep 17 00:00:00 2001 From: Kohei Watanabe Date: Mon, 27 Jul 2020 20:06:30 +0900 Subject: [PATCH] Unhandled promise rejection terminates Node.js process with non-zero exit code. --- playwright/main.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/playwright/main.js b/playwright/main.js index 50a59cf..63599c2 100644 --- a/playwright/main.js +++ b/playwright/main.js @@ -1,6 +1,11 @@ const playwright = require("playwright"); async function main() { + // NOTE: Unhandled promise rejection terminates Node.js process with non-zero exit code. + process.on("unhandledRejection", (event) => { + throw event; + }); + for (const browserType of ["chromium", "firefox", "webkit"]) { const browser = await playwright[browserType].launch(); const context = await browser.newContext();