From 117f068250de4425d4b2134f9132be2bf1d6dc07 Mon Sep 17 00:00:00 2001 From: samyuktaprabhu Date: Fri, 16 Sep 2022 20:33:56 +0200 Subject: [PATCH] test: use async/await in test-debugger-auto-resume PR-URL: https://github.com/nodejs/node/pull/44675 Reviewed-By: Rich Trott --- test/sequential/test-debugger-auto-resume.js | 36 ------------------- test/sequential/test-debugger-auto-resume.mjs | 35 ++++++++++++++++++ 2 files changed, 35 insertions(+), 36 deletions(-) delete mode 100644 test/sequential/test-debugger-auto-resume.js create mode 100644 test/sequential/test-debugger-auto-resume.mjs diff --git a/test/sequential/test-debugger-auto-resume.js b/test/sequential/test-debugger-auto-resume.js deleted file mode 100644 index 8a25f5fc804e1a..00000000000000 --- a/test/sequential/test-debugger-auto-resume.js +++ /dev/null @@ -1,36 +0,0 @@ -'use strict'; -const common = require('../common'); - -common.skipIfInspectorDisabled(); - -const fixtures = require('../common/fixtures'); -const startCLI = require('../common/debugger'); -const { addLibraryPath } = require('../common/shared-lib-util'); - -const assert = require('assert'); -const path = require('path'); - -addLibraryPath(process.env); - -// Auto-resume on start if the environment variable is defined. -{ - const scriptFullPath = fixtures.path('debugger', 'break.js'); - const script = path.relative(process.cwd(), scriptFullPath); - - const env = { ...process.env }; - env.NODE_INSPECT_RESUME_ON_START = '1'; - - const cli = startCLI([script], [], { env }); - - cli.waitForInitialBreak() - .then(() => { - assert.deepStrictEqual( - cli.breakInfo, - { filename: script, line: 10 }, - ); - }) - .then(() => cli.quit()) - .then((code) => { - assert.strictEqual(code, 0); - }); -} diff --git a/test/sequential/test-debugger-auto-resume.mjs b/test/sequential/test-debugger-auto-resume.mjs new file mode 100644 index 00000000000000..e2f18d6e2bc79b --- /dev/null +++ b/test/sequential/test-debugger-auto-resume.mjs @@ -0,0 +1,35 @@ +import { skipIfInspectorDisabled } from '../common/index.mjs'; + +skipIfInspectorDisabled(); + +import { path as _path } from '../common/fixtures.js'; +import startCLI from '../common/debugger.js'; +import { addLibraryPath } from '../common/shared-lib-util.js'; + +import { deepStrictEqual, strictEqual } from 'assert'; +import { relative } from 'path'; + +addLibraryPath(process.env); + +// Auto-resume on start if the environment variable is defined. +{ + const scriptFullPath = _path('debugger', 'break.js'); + const script = relative(process.cwd(), scriptFullPath); + + const env = { + ...process.env, + }; + env.NODE_INSPECT_RESUME_ON_START = '1'; + + const cli = startCLI([script], [], { + env, + }); + + await cli.waitForInitialBreak(); + deepStrictEqual(cli.breakInfo, { + filename: script, + line: 10, + }); + const code = await cli.quit(); + strictEqual(code, 0); +}