From 94020ac387713050150a9faed152f90bcf1ced54 Mon Sep 17 00:00:00 2001 From: Meek Simbule <55823259+meekdenzo@users.noreply.github.com> Date: Sun, 19 Jun 2022 05:04:48 -0500 Subject: [PATCH] test: refactor to top-level await PR-URL: https://github.com/nodejs/node/pull/43366 Reviewed-By: James M Snell Reviewed-By: Rich Trott --- ...> test-debugger-extract-function-name.mjs} | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) rename test/parallel/{test-debugger-extract-function-name.js => test-debugger-extract-function-name.mjs} (72%) diff --git a/test/parallel/test-debugger-extract-function-name.js b/test/parallel/test-debugger-extract-function-name.mjs similarity index 72% rename from test/parallel/test-debugger-extract-function-name.js rename to test/parallel/test-debugger-extract-function-name.mjs index 0f43ae65837831..e457fc7f521521 100644 --- a/test/parallel/test-debugger-extract-function-name.js +++ b/test/parallel/test-debugger-extract-function-name.mjs @@ -1,16 +1,15 @@ -'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'); +import assert from 'assert'; -const cli = startCLI([fixtures.path('debugger', 'three-lines.js')]); +const cli = startCLI([path('debugger', 'three-lines.js')]); -(async () => { +try { await cli.waitForInitialBreak(); await cli.waitForPrompt(); await cli.command('exec a = function func() {}; a;'); @@ -29,6 +28,6 @@ const cli = startCLI([fixtures.path('debugger', 'three-lines.js')]); assert.match(cli.output, /\[GeneratorFunction: function\*func\]/); await cli.command('exec a = function * func() {}; a;'); assert.match(cli.output, /\[GeneratorFunction\]/); -})() -.finally(() => cli.quit()) -.then(common.mustCall()); +} finally { + cli.quit(); +}