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 f4f08be

Browse filesBrowse files
anjanakvelloredanielleadams
authored andcommitted
test: use await in test-debugger-invalid-json
Changes the promises to async/await in test/parallel/test-debugger-invalid-json. PR-URL: #44689 Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent d2f3616 commit f4f08be
Copy full SHA for f4f08be

File tree

Expand file treeCollapse file tree

1 file changed

+18
-14
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+18
-14
lines changed
Open diff view settings
Collapse file
+18-14Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
'use strict';
2-
const common = require('../common');
3-
const startCLI = require('../common/debugger');
1+
import { skipIfInspectorDisabled, mustCall } from '../common/index.mjs';
42

5-
common.skipIfInspectorDisabled();
3+
skipIfInspectorDisabled();
64

7-
const assert = require('assert');
8-
const http = require('http');
5+
import startCLI from '../common/debugger.js';
6+
7+
import assert from 'assert';
8+
import http from 'http';
99

1010
const host = '127.0.0.1';
1111

@@ -14,14 +14,16 @@ const host = '127.0.0.1';
1414
res.statusCode = 400;
1515
res.end('Bad Request');
1616
});
17-
server.listen(0, common.mustCall(() => {
17+
18+
server.listen(0, mustCall(async () => {
1819
const port = server.address().port;
1920
const cli = startCLI([`${host}:${port}`]);
20-
cli.quit().then(common.mustCall((code) => {
21+
try {
22+
const code = await cli.quit();
2123
assert.strictEqual(code, 1);
22-
})).finally(() => {
24+
} finally {
2325
server.close();
24-
});
26+
}
2527
}));
2628
}
2729

@@ -30,13 +32,15 @@ const host = '127.0.0.1';
3032
res.statusCode = 200;
3133
res.end('some data that is invalid json');
3234
});
33-
server.listen(0, host, common.mustCall(() => {
35+
36+
server.listen(0, host, mustCall(async () => {
3437
const port = server.address().port;
3538
const cli = startCLI([`${host}:${port}`]);
36-
cli.quit().then(common.mustCall((code) => {
39+
try {
40+
const code = await cli.quit();
3741
assert.strictEqual(code, 1);
38-
})).finally(() => {
42+
} finally {
3943
server.close();
40-
});
44+
}
4145
}));
4246
}

0 commit comments

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