mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
test: convert then to async/await
PR-URL: https://github.com/nodejs/node/pull/43292 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
1 parent
5750358872
commit
b72b217dec
2 files changed
+35
-37
No files matched your search
@@ -53,21 +53,22 @@ function launchTarget(...args) {
|
||||
assert.ifError(error);
|
||||
}
|
||||
|
||||
return launchTarget('--inspect=0', script)
|
||||
.then(({ childProc, host, port }) => {
|
||||
(async () => {
|
||||
try {
|
||||
const { childProc, host, port } = await launchTarget('--inspect=0', script);
|
||||
target = childProc;
|
||||
cli = startCLI([`${host || '127.0.0.1'}:${port}`]);
|
||||
return cli.waitForPrompt();
|
||||
})
|
||||
.then(() => cli.command('sb("alive.js", 3)'))
|
||||
.then(() => cli.waitFor(/break/))
|
||||
.then(() => cli.waitForPrompt())
|
||||
.then(() => {
|
||||
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');
|
||||
})
|
||||
.then(() => cleanup())
|
||||
.then(null, cleanup);
|
||||
'marks the 3rd line'
|
||||
);
|
||||
} finally {
|
||||
cleanup();
|
||||
}
|
||||
})().then(common.mustCall());
|
||||
}
|
||||
@@ -10,28 +10,25 @@ const assert = require('assert');
|
||||
|
||||
const cli = startCLI([fixtures.path('debugger', 'three-lines.js')]);
|
||||
|
||||
function onFatal(error) {
|
||||
cli.quit();
|
||||
throw error;
|
||||
}
|
||||
|
||||
cli.waitForInitialBreak()
|
||||
.then(() => cli.waitForPrompt())
|
||||
.then(() => cli.command('exec a = function func() {}; a;'))
|
||||
.then(() => assert.match(cli.output, /\[Function: func\]/))
|
||||
.then(() => cli.command('exec a = function func () {}; a;'))
|
||||
.then(() => assert.match(cli.output, /\[Function\]/))
|
||||
.then(() => cli.command('exec a = function() {}; a;'))
|
||||
.then(() => assert.match(cli.output, /\[Function: function\]/))
|
||||
.then(() => cli.command('exec a = () => {}; a;'))
|
||||
.then(() => assert.match(cli.output, /\[Function\]/))
|
||||
.then(() => cli.command('exec a = function* func() {}; a;'))
|
||||
.then(() => assert.match(cli.output, /\[GeneratorFunction: func\]/))
|
||||
.then(() => cli.command('exec a = function *func() {}; a;'))
|
||||
.then(() => assert.match(cli.output, /\[GeneratorFunction: \*func\]/))
|
||||
.then(() => cli.command('exec a = function*func() {}; a;'))
|
||||
.then(() => assert.match(cli.output, /\[GeneratorFunction: function\*func\]/))
|
||||
.then(() => cli.command('exec a = function * func() {}; a;'))
|
||||
.then(() => assert.match(cli.output, /\[GeneratorFunction\]/))
|
||||
.then(() => cli.quit())
|
||||
.then(null, onFatal);
|
||||
(async () => {
|
||||
await cli.waitForInitialBreak();
|
||||
await cli.waitForPrompt();
|
||||
await cli.command('exec a = function func() {}; a;');
|
||||
assert.match(cli.output, /\[Function: func\]/);
|
||||
await cli.command('exec a = function func () {}; a;');
|
||||
assert.match(cli.output, /\[Function\]/);
|
||||
await cli.command('exec a = function() {}; a;');
|
||||
assert.match(cli.output, /\[Function: function\]/);
|
||||
await cli.command('exec a = () => {}; a;');
|
||||
assert.match(cli.output, /\[Function\]/);
|
||||
await cli.command('exec a = function* func() {}; a;');
|
||||
assert.match(cli.output, /\[GeneratorFunction: func\]/);
|
||||
await cli.command('exec a = function *func() {}; a;');
|
||||
assert.match(cli.output, /\[GeneratorFunction: \*func\]/);
|
||||
await cli.command('exec a = function*func() {}; a;');
|
||||
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());
|
||||
Reference in new issue
Block a user