Skip to content

Commit f25ba8c

Browse files
cola119juanarbol
authored andcommitted
test: add test for exception handlings in debugger
PR-URL: #42327 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent b250b8e commit f25ba8c

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
'use strict';
2+
const common = require('../common');
3+
const startCLI = require('../common/debugger');
4+
5+
common.skipIfInspectorDisabled();
6+
7+
const assert = require('assert');
8+
const http = require('http');
9+
10+
const host = '127.0.0.1';
11+
12+
{
13+
const server = http.createServer((req, res) => {
14+
res.statusCode = 400;
15+
res.end('Bad Request');
16+
});
17+
server.listen(0, common.mustCall(() => {
18+
const port = server.address().port;
19+
const cli = startCLI([`${host}:${port}`]);
20+
cli.quit().then(common.mustCall((code) => {
21+
assert.strictEqual(code, 1);
22+
})).finally(() => {
23+
server.close();
24+
});
25+
}));
26+
}
27+
28+
{
29+
const server = http.createServer((req, res) => {
30+
res.statusCode = 200;
31+
res.end('some data that is invalid json');
32+
});
33+
server.listen(0, host, common.mustCall(() => {
34+
const port = server.address().port;
35+
const cli = startCLI([`${host}:${port}`]);
36+
cli.quit().then(common.mustCall((code) => {
37+
assert.strictEqual(code, 1);
38+
})).finally(() => {
39+
server.close();
40+
});
41+
}));
42+
}

0 commit comments

Comments
 (0)