Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: refactor to await #44689

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,11 +1,11 @@
'use strict';
const common = require('../common');
const startCLI = require('../common/debugger');
import { skipIfInspectorDisabled, mustCall } from '../common/index.mjs';

common.skipIfInspectorDisabled();
skipIfInspectorDisabled();

const assert = require('assert');
const http = require('http');
import startCLI from '../common/debugger.js';

import assert from 'assert';
import http from 'http';

const host = '127.0.0.1';

Expand All @@ -14,14 +14,16 @@ const host = '127.0.0.1';
res.statusCode = 400;
res.end('Bad Request');
});
server.listen(0, common.mustCall(() => {

server.listen(0, mustCall(async () => {
const port = server.address().port;
const cli = startCLI([`${host}:${port}`]);
cli.quit().then(common.mustCall((code) => {
try {
const code = await cli.quit();
assert.strictEqual(code, 1);
})).finally(() => {
} finally {
server.close();
});
}
}));
}

Expand All @@ -30,13 +32,15 @@ const host = '127.0.0.1';
res.statusCode = 200;
res.end('some data that is invalid json');
});
server.listen(0, host, common.mustCall(() => {

server.listen(0, host, mustCall(async () => {
const port = server.address().port;
const cli = startCLI([`${host}:${port}`]);
cli.quit().then(common.mustCall((code) => {
try {
const code = await cli.quit();
assert.strictEqual(code, 1);
})).finally(() => {
} finally {
server.close();
});
}
}));
}