From fa95c4b45864de9c4fd955da2737cc6f0890200c Mon Sep 17 00:00:00 2001 From: mmeenapriya <42589859+mmeenapriya@users.noreply.github.com> Date: Fri, 16 Sep 2022 16:38:47 -0500 Subject: [PATCH 1/5] test: update test-debugger-scripts to use await/async --- test/sequential/test-debugger-scripts.js | 63 +++++++++++------------- 1 file changed, 28 insertions(+), 35 deletions(-) diff --git a/test/sequential/test-debugger-scripts.js b/test/sequential/test-debugger-scripts.js index c6d4e67920921d..deb0a626c84ee4 100644 --- a/test/sequential/test-debugger-scripts.js +++ b/test/sequential/test-debugger-scripts.js @@ -9,39 +9,32 @@ const startCLI = require('../common/debugger'); const assert = require('assert'); // List scripts. -{ - const script = fixtures.path('debugger', 'three-lines.js'); - const cli = startCLI([script]); +const script = fixtures.path('debugger', 'three-lines.js'); +const cli = startCLI([script]); - function onFatal(error) { - cli.quit(); - throw error; - } - - return cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => cli.command('scripts')) - .then(() => { - assert.match( - cli.output, - /^\* \d+: \S+debugger(?:\/|\\)three-lines\.js/m, - 'lists the user script'); - assert.doesNotMatch( - cli.output, - /\d+: node:internal\/buffer/, - 'omits node-internal scripts'); - }) - .then(() => cli.command('scripts(true)')) - .then(() => { - assert.match( - cli.output, - /\* \d+: \S+debugger(?:\/|\\)three-lines\.js/, - 'lists the user script'); - assert.match( - cli.output, - /\d+: node:internal\/buffer/, - 'includes node-internal scripts'); - }) - .then(() => cli.quit()) - .then(null, onFatal); -} +(async () => { +try{ + await cli.waitForInitialBreak(); + await cli.waitForPrompt(); + await cli.command('scripts'); + assert.match( + cli.output, + /^\* \d+: \S+debugger(?:\/|\\)three-lines\.js/m, + 'lists the user script'); + assert.doesNotMatch( + cli.output, + /\d+: node:internal\/buffer/, + 'omits node-internal scripts'); + await cli.command('scripts(true)'); + assert.match( + cli.output, + /\* \d+: \S+debugger(?:\/|\\)three-lines\.js/, + 'lists the user script'); + assert.match( + cli.output, + /\d+: node:internal\/buffer/, + 'includes node-internal scripts'); + } finally { + cli.quit() + } +})() From 6318b7cd48217f2a9c6ece39812a2d0cf37c922c Mon Sep 17 00:00:00 2001 From: mmeenapriya <42589859+mmeenapriya@users.noreply.github.com> Date: Sat, 17 Sep 2022 17:35:27 -0500 Subject: [PATCH 2/5] test: update test-debugger-scripts to use await/async - fix lint errors --- test/sequential/test-debugger-scripts.js | 46 ++++++++++++++++++++---- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/test/sequential/test-debugger-scripts.js b/test/sequential/test-debugger-scripts.js index deb0a626c84ee4..9f0b8fea5f9267 100644 --- a/test/sequential/test-debugger-scripts.js +++ b/test/sequential/test-debugger-scripts.js @@ -9,11 +9,43 @@ const startCLI = require('../common/debugger'); const assert = require('assert'); // List scripts. -const script = fixtures.path('debugger', 'three-lines.js'); -const cli = startCLI([script]); +{ + const script = fixtures.path('debugger', 'three-lines.js'); + const cli = startCLI([script]); + + function onFatal(error) { + cli.quit(); + throw error; + } + + // return cli.waitForInitialBreak() + // .then(() => cli.waitForPrompt()) + // .then(() => cli.command('scripts')) + // .then(() => { + // assert.match( + // cli.output, + // /^\* \d+: \S+debugger(?:\/|\\)three-lines\.js/m, + // 'lists the user script'); + // assert.doesNotMatch( + // cli.output, + // /\d+: node:internal\/buffer/, + // 'omits node-internal scripts'); + // }) + // .then(() => cli.command('scripts(true)')) + // .then(() => { + // assert.match( + // cli.output, + // /\* \d+: \S+debugger(?:\/|\\)three-lines\.js/, + // 'lists the user script'); + // assert.match( + // cli.output, + // /\d+: node:internal\/buffer/, + // 'includes node-internal scripts'); + // }) + // .then(() => cli.quit()) + // .then(null, onFatal); (async () => { -try{ await cli.waitForInitialBreak(); await cli.waitForPrompt(); await cli.command('scripts'); @@ -34,7 +66,9 @@ try{ cli.output, /\d+: node:internal\/buffer/, 'includes node-internal scripts'); - } finally { - cli.quit() - } + })() +.then(() => cli.quit()) +.then(null, onFatal); + +} From 90994fd5f533594d2e7f8f2680c34418fdfa8efa Mon Sep 17 00:00:00 2001 From: mmeenapriya <42589859+mmeenapriya@users.noreply.github.com> Date: Sat, 17 Sep 2022 17:42:36 -0500 Subject: [PATCH 3/5] test: update test-debugger-scripts to use await/async -fix lint errors --- test/sequential/test-debugger-scripts.js | 49 ++++++++++++------------ 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/test/sequential/test-debugger-scripts.js b/test/sequential/test-debugger-scripts.js index 9f0b8fea5f9267..72e77f2e20e11c 100644 --- a/test/sequential/test-debugger-scripts.js +++ b/test/sequential/test-debugger-scripts.js @@ -45,30 +45,29 @@ const assert = require('assert'); // .then(() => cli.quit()) // .then(null, onFatal); -(async () => { - await cli.waitForInitialBreak(); - await cli.waitForPrompt(); - await cli.command('scripts'); - assert.match( - cli.output, - /^\* \d+: \S+debugger(?:\/|\\)three-lines\.js/m, - 'lists the user script'); - assert.doesNotMatch( - cli.output, - /\d+: node:internal\/buffer/, - 'omits node-internal scripts'); - await cli.command('scripts(true)'); - assert.match( - cli.output, - /\* \d+: \S+debugger(?:\/|\\)three-lines\.js/, - 'lists the user script'); - assert.match( - cli.output, - /\d+: node:internal\/buffer/, - 'includes node-internal scripts'); - -})() -.then(() => cli.quit()) -.then(null, onFatal); + (async () => { + await cli.waitForInitialBreak(); + await cli.waitForPrompt(); + await cli.command('scripts'); + assert.match( + cli.output, + /^\* \d+: \S+debugger(?:\/|\\)three-lines\.js/m, + 'lists the user script'); + assert.doesNotMatch( + cli.output, + /\d+: node:internal\/buffer/, + 'omits node-internal scripts'); + await cli.command('scripts(true)'); + assert.match( + cli.output, + /\* \d+: \S+debugger(?:\/|\\)three-lines\.js/, + 'lists the user script'); + assert.match( + cli.output, + /\d+: node:internal\/buffer/, + 'includes node-internal scripts'); + })() + .then(() => cli.quit()) + .then(null, onFatal); } From 32e44f76454d7bbd26374c9c42b1e2e8283bb8a7 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 26 Sep 2022 15:23:06 -0700 Subject: [PATCH 4/5] fixup! test: update test-debugger-scripts to use await/async -fix lint errors --- test/sequential/test-debugger-scripts.js | 41 +++--------------------- 1 file changed, 5 insertions(+), 36 deletions(-) diff --git a/test/sequential/test-debugger-scripts.js b/test/sequential/test-debugger-scripts.js index 72e77f2e20e11c..ddef77dd35177c 100644 --- a/test/sequential/test-debugger-scripts.js +++ b/test/sequential/test-debugger-scripts.js @@ -13,39 +13,8 @@ const assert = require('assert'); const script = fixtures.path('debugger', 'three-lines.js'); const cli = startCLI([script]); - function onFatal(error) { - cli.quit(); - throw error; - } - - // return cli.waitForInitialBreak() - // .then(() => cli.waitForPrompt()) - // .then(() => cli.command('scripts')) - // .then(() => { - // assert.match( - // cli.output, - // /^\* \d+: \S+debugger(?:\/|\\)three-lines\.js/m, - // 'lists the user script'); - // assert.doesNotMatch( - // cli.output, - // /\d+: node:internal\/buffer/, - // 'omits node-internal scripts'); - // }) - // .then(() => cli.command('scripts(true)')) - // .then(() => { - // assert.match( - // cli.output, - // /\* \d+: \S+debugger(?:\/|\\)three-lines\.js/, - // 'lists the user script'); - // assert.match( - // cli.output, - // /\d+: node:internal\/buffer/, - // 'includes node-internal scripts'); - // }) - // .then(() => cli.quit()) - // .then(null, onFatal); - (async () => { + try { await cli.waitForInitialBreak(); await cli.waitForPrompt(); await cli.command('scripts'); @@ -66,8 +35,8 @@ const assert = require('assert'); cli.output, /\d+: node:internal\/buffer/, 'includes node-internal scripts'); - })() - .then(() => cli.quit()) - .then(null, onFatal); - + } finally { + await cli.quit(); + } + })().then(common.mustCall); } From c8d01062ef856501b067b2743640cc51097b8d43 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 28 Sep 2022 19:56:34 -0700 Subject: [PATCH 5/5] fixup! fixup! test: update test-debugger-scripts to use await/async -fix lint errors --- test/sequential/test-debugger-scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sequential/test-debugger-scripts.js b/test/sequential/test-debugger-scripts.js index ddef77dd35177c..b0f611bd1c6491 100644 --- a/test/sequential/test-debugger-scripts.js +++ b/test/sequential/test-debugger-scripts.js @@ -38,5 +38,5 @@ const assert = require('assert'); } finally { await cli.quit(); } - })().then(common.mustCall); + })().then(common.mustCall()); }