mirror of
https://github.com/nodejs/node.git
synced 2025-12-28 07:50:41 +00:00
test: change promises to async/await
PR-URL: https://github.com/nodejs/node/pull/44683 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
parent
e58c7ccc97
commit
1e6153c090
@ -1,47 +0,0 @@
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
|
||||
common.skipIfInspectorDisabled();
|
||||
|
||||
const fixtures = require('../common/fixtures');
|
||||
const startCLI = require('../common/debugger');
|
||||
|
||||
const assert = require('assert');
|
||||
|
||||
{
|
||||
const script = fixtures.path('debugger', 'three-lines.js');
|
||||
const cli = startCLI([script]);
|
||||
|
||||
cli.waitForInitialBreak()
|
||||
.then(() => cli.waitForPrompt())
|
||||
.then(() => {
|
||||
assert.match(cli.output, /debug>/, 'prints a prompt');
|
||||
assert.match(
|
||||
cli.output,
|
||||
/< Debugger listening on [^\n]*9229/,
|
||||
'forwards child output');
|
||||
})
|
||||
.then(() => cli.command('["hello", "world"].join(" ")'))
|
||||
.then(() => {
|
||||
assert.match(cli.output, /hello world/, 'prints the result');
|
||||
})
|
||||
.then(() => cli.command(''))
|
||||
.then(() => {
|
||||
assert.match(
|
||||
cli.output,
|
||||
/hello world/,
|
||||
'repeats the last command on <enter>'
|
||||
);
|
||||
})
|
||||
.then(() => cli.command('version'))
|
||||
.then(() => {
|
||||
assert.ok(
|
||||
cli.output.includes(process.versions.v8),
|
||||
'version prints the v8 version'
|
||||
);
|
||||
})
|
||||
.then(() => cli.quit())
|
||||
.then((code) => {
|
||||
assert.strictEqual(code, 0);
|
||||
});
|
||||
}
|
||||
36
test/sequential/test-debugger-launch.mjs
Normal file
36
test/sequential/test-debugger-launch.mjs
Normal file
@ -0,0 +1,36 @@
|
||||
import { skipIfInspectorDisabled } from '../common/index.mjs';
|
||||
skipIfInspectorDisabled();
|
||||
|
||||
import { path } from '../common/fixtures.mjs';
|
||||
import startCLI from '../common/debugger.js';
|
||||
|
||||
import assert from 'assert';
|
||||
|
||||
const script = path('debugger', 'three-lines.js');
|
||||
const cli = startCLI([script]);
|
||||
try {
|
||||
await cli.waitForInitialBreak();
|
||||
await cli.waitForPrompt();
|
||||
assert.match(cli.output, /debug>/, 'prints a prompt');
|
||||
assert.match(
|
||||
cli.output,
|
||||
/< Debugger listening on [^\n]*9229/,
|
||||
'forwards child output'
|
||||
);
|
||||
await cli.command('["hello", "world"].join(" ")');
|
||||
assert.match(cli.output, /hello world/, 'prints the result');
|
||||
await cli.command('');
|
||||
assert.match(
|
||||
cli.output,
|
||||
/hello world/,
|
||||
'repeats the last command on <enter>'
|
||||
);
|
||||
await cli.command('version');
|
||||
assert.ok(
|
||||
cli.output.includes(process.versions.v8),
|
||||
'version prints the v8 version'
|
||||
);
|
||||
} finally {
|
||||
const code = await cli.quit();
|
||||
assert.strictEqual(code, 0);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user