From 069a67eff89f63c6b54a9fe7de79adcf18ea23d4 Mon Sep 17 00:00:00 2001 From: Meek Denzo Date: Sun, 19 Jun 2022 22:50:20 -0500 Subject: [PATCH 1/3] test: refactor to top-level await --- ...r-address.js => test-debugger-address.mjs} | 49 +++++++++---------- 1 file changed, 23 insertions(+), 26 deletions(-) rename test/parallel/{test-debugger-address.js => test-debugger-address.mjs} (54%) diff --git a/test/parallel/test-debugger-address.js b/test/parallel/test-debugger-address.mjs similarity index 54% rename from test/parallel/test-debugger-address.js rename to test/parallel/test-debugger-address.mjs index e8cfd428ebcb05..13113ca4b9c63c 100644 --- a/test/parallel/test-debugger-address.js +++ b/test/parallel/test-debugger-address.mjs @@ -1,13 +1,12 @@ -'use strict'; -const common = require('../common'); +import { skipIfInspectorDisabled } from '../common/index.mjs'; -common.skipIfInspectorDisabled(); +skipIfInspectorDisabled(); -const fixtures = require('../common/fixtures'); -const startCLI = require('../common/debugger'); +import { path } from '../common/fixtures.mjs'; +import startCLI from '../common/debugger.js'; -const assert = require('assert'); -const { spawn } = require('child_process'); +import assert from 'assert'; +import { spawn } from 'child_process'; // NOTE(oyyd): We might want to import this regexp from "lib/_inspect.js"? const kDebuggerMsgReg = /Debugger listening on ws:\/\/\[?(.+?)\]?:(\d+)\//; @@ -37,7 +36,7 @@ function launchTarget(...args) { } { - const script = fixtures.path('debugger/alive.js'); + const script = path('debugger/alive.js'); let cli = null; let target = null; @@ -53,22 +52,20 @@ function launchTarget(...args) { assert.ifError(error); } - (async () => { - try { - const { childProc, host, port } = await launchTarget('--inspect=0', script); - target = childProc; - cli = startCLI([`${host || '127.0.0.1'}:${port}`]); - 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' - ); - } finally { - cleanup(); - } - })().then(common.mustCall()); + try { + const { childProc, host, port } = await launchTarget('--inspect=0', script); + target = childProc; + cli = startCLI([`${host || '127.0.0.1'}:${port}`]); + 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' + ); + } finally { + cleanup(); + } } From b6da998f7263d618f74ec6e687b078a2434a6144 Mon Sep 17 00:00:00 2001 From: Meek Simbule <55823259+meekdenzo@users.noreply.github.com> Date: Thu, 23 Jun 2022 10:10:59 -0500 Subject: [PATCH 2/3] Update test/parallel/test-debugger-address.mjs Co-authored-by: Antoine du Hamel --- test/parallel/test-debugger-address.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-debugger-address.mjs b/test/parallel/test-debugger-address.mjs index 13113ca4b9c63c..d500e982b57af6 100644 --- a/test/parallel/test-debugger-address.mjs +++ b/test/parallel/test-debugger-address.mjs @@ -2,7 +2,7 @@ import { skipIfInspectorDisabled } from '../common/index.mjs'; skipIfInspectorDisabled(); -import { path } from '../common/fixtures.mjs'; +import * as fixtures from '../common/fixtures.mjs'; import startCLI from '../common/debugger.js'; import assert from 'assert'; From a36b9a2cc0ad87a1b6bc23057eb736c5a6048a1a Mon Sep 17 00:00:00 2001 From: Meek Simbule <55823259+meekdenzo@users.noreply.github.com> Date: Thu, 23 Jun 2022 10:13:16 -0500 Subject: [PATCH 3/3] Update test/parallel/test-debugger-address.mjs --- test/parallel/test-debugger-address.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-debugger-address.mjs b/test/parallel/test-debugger-address.mjs index d500e982b57af6..eab99c9b0e2fb3 100644 --- a/test/parallel/test-debugger-address.mjs +++ b/test/parallel/test-debugger-address.mjs @@ -36,7 +36,7 @@ function launchTarget(...args) { } { - const script = path('debugger/alive.js'); + const script = fixtures.path('debugger/alive.js'); let cli = null; let target = null;