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 <rtrott@gmail.com>
This commit is contained in:
Ankita Khiratkar authored and Danielle Adams committed 2022-10-05 11:52:56 +01:00
1 parent 3ad0fae89d
commit 4db72a65cf
2 files changed
+23 -38

No files matched your search

@@ -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);
}
@@ -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();
}