From 13e69b7059e5f497b609db985c9de97522f5d4db Mon Sep 17 00:00:00 2001
From: Luke Karrys <luke@lukekarrys.com>
Date: Tue, 25 Oct 2022 12:26:39 -0700
Subject: [PATCH 1/3] test: convert test-debugger-pid to async/await

---
 test/sequential/test-debugger-pid.js | 59 ++++++++++------------------
 1 file changed, 21 insertions(+), 38 deletions(-)

diff --git a/test/sequential/test-debugger-pid.js b/test/sequential/test-debugger-pid.js
index 0056113ecaecd3..78f3d5f23da2a3 100644
--- a/test/sequential/test-debugger-pid.js
+++ b/test/sequential/test-debugger-pid.js
@@ -9,44 +9,27 @@ const startCLI = require('../common/debugger');
 const assert = require('assert');
 const { spawn } = require('child_process');
 
-
-function launchTarget(...args) {
-  const childProc = spawn(process.execPath, args);
-  return Promise.resolve(childProc);
-}
-
-{
-  const script = fixtures.path('debugger', 'alive.js');
-  let cli = null;
-  let target = null;
-
-  function cleanup(error) {
-    if (cli) {
-      cli.quit();
-      cli = null;
-    }
-    if (target) {
-      target.kill();
-      target = null;
-    }
+const script = fixtures.path('debugger', 'alive.js');
+
+const runTest = async () => {
+  const target = spawn(process.execPath, [script]);
+  const cli = startCLI(['-p', `${target.pid}`]);
+
+  try {  
+    await cli.waitForPrompt();
+    await cli.command('sb("alive.js", 3)');
+    await cli.waitFor(/break/);
+    await cli.waitForPrompt();
+    assert.match(
+      cli.output,
+      /> 3 {3}\+\+x;/,
+      'marks the 3rd line');
+  } catch (error) {
     assert.ifError(error);
+  } finally {
+    await cli.quit();
+    target.kill();
   }
-
-  return launchTarget(script)
-    .then((childProc) => {
-      target = childProc;
-      cli = startCLI(['-p', `${target.pid}`]);
-      return cli.waitForPrompt();
-    })
-    .then(() => cli.command('sb("alive.js", 3)'))
-    .then(() => cli.waitFor(/break/))
-    .then(() => cli.waitForPrompt())
-    .then(() => {
-      assert.match(
-        cli.output,
-        /> 3 {3}\+\+x;/,
-        'marks the 3rd line');
-    })
-    .then(() => cleanup())
-    .then(null, cleanup);
 }
+
+runTest()

From f2cd26664bb3f54ed209a892458efc2704c0ba10 Mon Sep 17 00:00:00 2001
From: Luke Karrys <luke@lukekarrys.com>
Date: Tue, 25 Oct 2022 13:06:17 -0700
Subject: [PATCH 2/3] fixup! test: convert test-debugger-pid to async/await

---
 test/sequential/test-debugger-pid.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/sequential/test-debugger-pid.js b/test/sequential/test-debugger-pid.js
index 78f3d5f23da2a3..af5492dd12d032 100644
--- a/test/sequential/test-debugger-pid.js
+++ b/test/sequential/test-debugger-pid.js
@@ -15,7 +15,7 @@ const runTest = async () => {
   const target = spawn(process.execPath, [script]);
   const cli = startCLI(['-p', `${target.pid}`]);
 
-  try {  
+  try {
     await cli.waitForPrompt();
     await cli.command('sb("alive.js", 3)');
     await cli.waitFor(/break/);
@@ -30,6 +30,6 @@ const runTest = async () => {
     await cli.quit();
     target.kill();
   }
-}
+};
 
-runTest()
+runTest();

From c24d335484aa4e805fcde86a4cfcd1579ea40a3c Mon Sep 17 00:00:00 2001
From: Rich Trott <rtrott@gmail.com>
Date: Fri, 28 Oct 2022 14:28:35 -0700
Subject: [PATCH 3/3] Update test/sequential/test-debugger-pid.js

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
---
 test/sequential/test-debugger-pid.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/sequential/test-debugger-pid.js b/test/sequential/test-debugger-pid.js
index af5492dd12d032..99062149dfe337 100644
--- a/test/sequential/test-debugger-pid.js
+++ b/test/sequential/test-debugger-pid.js
@@ -32,4 +32,4 @@ const runTest = async () => {
   }
 };
 
-runTest();
+runTest().then(common.mustCall());