From 4db72a65cf84b0744fd2cb2d6dcb36c30ebfd8e4 Mon Sep 17 00:00:00 2001 From: Ankita Khiratkar Date: Tue, 27 Sep 2022 01:26:58 -0500 Subject: [PATCH] test: change the promises to async/await in test-debugger-exec-scope.js PR-URL: https://github.com/nodejs/node/pull/44685 Reviewed-By: Rich Trott --- test/sequential/test-debugger-exec-scope.js | 38 -------------------- test/sequential/test-debugger-exec-scope.mjs | 23 ++++++++++++ 2 files changed, 23 insertions(+), 38 deletions(-) delete mode 100644 test/sequential/test-debugger-exec-scope.js create mode 100644 test/sequential/test-debugger-exec-scope.mjs diff --git a/test/sequential/test-debugger-exec-scope.js b/test/sequential/test-debugger-exec-scope.js deleted file mode 100644 index 9e5d2ac7ebaeeb..00000000000000 --- a/test/sequential/test-debugger-exec-scope.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict'; -const common = require('../common'); - -common.skipIfInspectorDisabled(); - -const fixtures = require('../common/fixtures'); -const startCLI = require('../common/debugger'); - -const assert = require('assert'); - -// exec .scope -{ - const cli = startCLI([fixtures.path('debugger/backtrace.js')]); - - function onFatal(error) { - cli.quit(); - throw error; - } - - cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => cli.stepCommand('c')) - .then(() => cli.command('exec .scope')) - .then(() => { - assert.match( - cli.output, - /'moduleScoped'/, 'displays closure from module body'); - assert.match(cli.output, /'a'/, 'displays local / function arg'); - assert.match(cli.output, /'l1'/, 'displays local scope'); - assert.doesNotMatch( - cli.output, - /'encodeURIComponent'/, - 'omits global scope' - ); - }) - .then(() => cli.quit()) - .then(null, onFatal); -} diff --git a/test/sequential/test-debugger-exec-scope.mjs b/test/sequential/test-debugger-exec-scope.mjs new file mode 100644 index 00000000000000..08b37e279556f2 --- /dev/null +++ b/test/sequential/test-debugger-exec-scope.mjs @@ -0,0 +1,23 @@ +import { skipIfInspectorDisabled } from '../common/index.mjs'; + +skipIfInspectorDisabled(); + +import { path } from '../common/fixtures.mjs'; +import startCLI from '../common/debugger.js'; + +import assert from 'assert'; + +const cli = startCLI([path('debugger/backtrace.js')]); + +try { + await cli.waitForInitialBreak(); + await cli.waitForPrompt(); + await cli.stepCommand('c'); + await cli.command('exec .scope'); + assert.match(cli.output, /'moduleScoped'/, 'displays closure from module body'); + assert.match(cli.output, /'a'/, 'displays local / function arg'); + assert.match(cli.output, /'l1'/, 'displays local scope'); + assert.doesNotMatch(cli.output, /'encodeURIComponent'/, 'omits global scope'); +} finally { + await cli.quit(); +}