From 863361928e9219f9412b6934a4c70b146ee2e27a Mon Sep 17 00:00:00 2001 From: Madhulika Sharma <89944545+MadhulikaSharma95@users.noreply.github.com> Date: Mon, 26 Sep 2022 02:19:11 -0400 Subject: [PATCH] test: change promises to async/await MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/44683 Reviewed-By: Tobias Nießen Reviewed-By: Rich Trott --- test/sequential/test-debugger-launch.js | 47 ------------------------ test/sequential/test-debugger-launch.mjs | 36 ++++++++++++++++++ 2 files changed, 36 insertions(+), 47 deletions(-) delete mode 100644 test/sequential/test-debugger-launch.js create mode 100644 test/sequential/test-debugger-launch.mjs diff --git a/test/sequential/test-debugger-launch.js b/test/sequential/test-debugger-launch.js deleted file mode 100644 index 3bfe541ecca05c..00000000000000 --- a/test/sequential/test-debugger-launch.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; -const common = require('../common'); - -common.skipIfInspectorDisabled(); - -const fixtures = require('../common/fixtures'); -const startCLI = require('../common/debugger'); - -const assert = require('assert'); - -{ - const script = fixtures.path('debugger', 'three-lines.js'); - const cli = startCLI([script]); - - cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => { - assert.match(cli.output, /debug>/, 'prints a prompt'); - assert.match( - cli.output, - /< Debugger listening on [^\n]*9229/, - 'forwards child output'); - }) - .then(() => cli.command('["hello", "world"].join(" ")')) - .then(() => { - assert.match(cli.output, /hello world/, 'prints the result'); - }) - .then(() => cli.command('')) - .then(() => { - assert.match( - cli.output, - /hello world/, - 'repeats the last command on ' - ); - }) - .then(() => cli.command('version')) - .then(() => { - assert.ok( - cli.output.includes(process.versions.v8), - 'version prints the v8 version' - ); - }) - .then(() => cli.quit()) - .then((code) => { - assert.strictEqual(code, 0); - }); -} diff --git a/test/sequential/test-debugger-launch.mjs b/test/sequential/test-debugger-launch.mjs new file mode 100644 index 00000000000000..9d4016c1f5d5e4 --- /dev/null +++ b/test/sequential/test-debugger-launch.mjs @@ -0,0 +1,36 @@ +import { skipIfInspectorDisabled } from '../common/index.mjs'; +skipIfInspectorDisabled(); + +import { path } from '../common/fixtures.mjs'; +import startCLI from '../common/debugger.js'; + +import assert from 'assert'; + +const script = path('debugger', 'three-lines.js'); +const cli = startCLI([script]); +try { + await cli.waitForInitialBreak(); + await cli.waitForPrompt(); + assert.match(cli.output, /debug>/, 'prints a prompt'); + assert.match( + cli.output, + /< Debugger listening on [^\n]*9229/, + 'forwards child output' + ); + await cli.command('["hello", "world"].join(" ")'); + assert.match(cli.output, /hello world/, 'prints the result'); + await cli.command(''); + assert.match( + cli.output, + /hello world/, + 'repeats the last command on ' + ); + await cli.command('version'); + assert.ok( + cli.output.includes(process.versions.v8), + 'version prints the v8 version' + ); +} finally { + const code = await cli.quit(); + assert.strictEqual(code, 0); +}