Skip to content

Commit

Permalink
test: refactor to top-level await
Browse files Browse the repository at this point in the history
PR-URL: #43500
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
meekdenzo authored and targos committed Jul 12, 2022
1 parent 919c5ee commit bd91337
Showing 1 changed file with 22 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
'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 * as fixtures from '../common/fixtures.mjs';
import startCLI from '../common/debugger.js';

const assert = require('assert');
const { spawn } = require('child_process');
import assert from 'assert';
import { spawn } from 'child_process';

// NOTE(oyyd): We might want to import this regexp from "lib/_inspect.js"?
const kDebuggerMsgReg = /Debugger listening on ws:\/\/\[?(.+?)\]?:(\d+)\//;
Expand Down Expand Up @@ -53,22 +52,20 @@ function launchTarget(...args) {
assert.ifError(error);
}

(async () => {
try {
const { childProc, host, port } = await launchTarget('--inspect=0', script);
target = childProc;
cli = startCLI([`${host || '127.0.0.1'}:${port}`]);
await cli.waitForPrompt();
await cli.command('sb("alive.js", 3)');
await cli.waitFor(/break/);
await cli.waitForPrompt();
assert.match(
cli.output,
/> 3 {3}\+\+x;/,
'marks the 3rd line'
);
} finally {
cleanup();
}
})().then(common.mustCall());
try {
const { childProc, host, port } = await launchTarget('--inspect=0', script);
target = childProc;
cli = startCLI([`${host || '127.0.0.1'}:${port}`]);
await cli.waitForPrompt();
await cli.command('sb("alive.js", 3)');
await cli.waitFor(/break/);
await cli.waitForPrompt();
assert.match(
cli.output,
/> 3 {3}\+\+x;/,
'marks the 3rd line'
);
} finally {
cleanup();
}
}

0 comments on commit bd91337

Please sign in to comment.