mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
70047b0c34
Changes the promises to async/await in test/parallel/test-debugger-invalid-json. PR-URL: https://github.com/nodejs/node/pull/44689 Reviewed-By: Rich Trott <rtrott@gmail.com>
47 lines
1013 B
JavaScript
47 lines
1013 B
JavaScript
import { skipIfInspectorDisabled, mustCall } from '../common/index.mjs';
|
|
|
|
skipIfInspectorDisabled();
|
|
|
|
import startCLI from '../common/debugger.js';
|
|
|
|
import assert from 'assert';
|
|
import http from 'http';
|
|
|
|
const host = '127.0.0.1';
|
|
|
|
{
|
|
const server = http.createServer((req, res) => {
|
|
res.statusCode = 400;
|
|
res.end('Bad Request');
|
|
});
|
|
|
|
server.listen(0, mustCall(async () => {
|
|
const port = server.address().port;
|
|
const cli = startCLI([`${host}:${port}`]);
|
|
try {
|
|
const code = await cli.quit();
|
|
assert.strictEqual(code, 1);
|
|
} finally {
|
|
server.close();
|
|
}
|
|
}));
|
|
}
|
|
|
|
{
|
|
const server = http.createServer((req, res) => {
|
|
res.statusCode = 200;
|
|
res.end('some data that is invalid json');
|
|
});
|
|
|
|
server.listen(0, host, mustCall(async () => {
|
|
const port = server.address().port;
|
|
const cli = startCLI([`${host}:${port}`]);
|
|
try {
|
|
const code = await cli.quit();
|
|
assert.strictEqual(code, 1);
|
|
} finally {
|
|
server.close();
|
|
}
|
|
}));
|
|
}
|