Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 18fffe6

Browse filesBrowse files
meekdenzodanielleadams
authored andcommitted
test: convert then to async/await
PR-URL: #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>
1 parent 201f3d7 commit 18fffe6
Copy full SHA for 18fffe6

File tree

Expand file treeCollapse file tree

2 files changed

+35
-37
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+35
-37
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-debugger-address.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-debugger-address.js
+13-12Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,22 @@ function launchTarget(...args) {
5353
assert.ifError(error);
5454
}
5555

56-
return launchTarget('--inspect=0', script)
57-
.then(({ childProc, host, port }) => {
56+
(async () => {
57+
try {
58+
const { childProc, host, port } = await launchTarget('--inspect=0', script);
5859
target = childProc;
5960
cli = startCLI([`${host || '127.0.0.1'}:${port}`]);
60-
return cli.waitForPrompt();
61-
})
62-
.then(() => cli.command('sb("alive.js", 3)'))
63-
.then(() => cli.waitFor(/break/))
64-
.then(() => cli.waitForPrompt())
65-
.then(() => {
61+
await cli.waitForPrompt();
62+
await cli.command('sb("alive.js", 3)');
63+
await cli.waitFor(/break/);
64+
await cli.waitForPrompt();
6665
assert.match(
6766
cli.output,
6867
/> 3 {3}\+\+x;/,
69-
'marks the 3rd line');
70-
})
71-
.then(() => cleanup())
72-
.then(null, cleanup);
68+
'marks the 3rd line'
69+
);
70+
} finally {
71+
cleanup();
72+
}
73+
})().then(common.mustCall());
7374
}
Collapse file

‎test/parallel/test-debugger-extract-function-name.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-debugger-extract-function-name.js
+22-25Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,25 @@ const assert = require('assert');
1010

1111
const cli = startCLI([fixtures.path('debugger', 'three-lines.js')]);
1212

13-
function onFatal(error) {
14-
cli.quit();
15-
throw error;
16-
}
17-
18-
cli.waitForInitialBreak()
19-
.then(() => cli.waitForPrompt())
20-
.then(() => cli.command('exec a = function func() {}; a;'))
21-
.then(() => assert.match(cli.output, /\[Function: func\]/))
22-
.then(() => cli.command('exec a = function func () {}; a;'))
23-
.then(() => assert.match(cli.output, /\[Function\]/))
24-
.then(() => cli.command('exec a = function() {}; a;'))
25-
.then(() => assert.match(cli.output, /\[Function: function\]/))
26-
.then(() => cli.command('exec a = () => {}; a;'))
27-
.then(() => assert.match(cli.output, /\[Function\]/))
28-
.then(() => cli.command('exec a = function* func() {}; a;'))
29-
.then(() => assert.match(cli.output, /\[GeneratorFunction: func\]/))
30-
.then(() => cli.command('exec a = function *func() {}; a;'))
31-
.then(() => assert.match(cli.output, /\[GeneratorFunction: \*func\]/))
32-
.then(() => cli.command('exec a = function*func() {}; a;'))
33-
.then(() => assert.match(cli.output, /\[GeneratorFunction: function\*func\]/))
34-
.then(() => cli.command('exec a = function * func() {}; a;'))
35-
.then(() => assert.match(cli.output, /\[GeneratorFunction\]/))
36-
.then(() => cli.quit())
37-
.then(null, onFatal);
13+
(async () => {
14+
await cli.waitForInitialBreak();
15+
await cli.waitForPrompt();
16+
await cli.command('exec a = function func() {}; a;');
17+
assert.match(cli.output, /\[Function: func\]/);
18+
await cli.command('exec a = function func () {}; a;');
19+
assert.match(cli.output, /\[Function\]/);
20+
await cli.command('exec a = function() {}; a;');
21+
assert.match(cli.output, /\[Function: function\]/);
22+
await cli.command('exec a = () => {}; a;');
23+
assert.match(cli.output, /\[Function\]/);
24+
await cli.command('exec a = function* func() {}; a;');
25+
assert.match(cli.output, /\[GeneratorFunction: func\]/);
26+
await cli.command('exec a = function *func() {}; a;');
27+
assert.match(cli.output, /\[GeneratorFunction: \*func\]/);
28+
await cli.command('exec a = function*func() {}; a;');
29+
assert.match(cli.output, /\[GeneratorFunction: function\*func\]/);
30+
await cli.command('exec a = function * func() {}; a;');
31+
assert.match(cli.output, /\[GeneratorFunction\]/);
32+
})()
33+
.finally(() => cli.quit())
34+
.then(common.mustCall());

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.