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: string to template literals, to include port #20889

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/parallel/test-net-listen-exclusive-random-ports.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ if (cluster.isMaster) {
const worker1 = cluster.fork();

worker1.on('message', function(port1) {
assert.strictEqual(port1, port1 | 0, 'first worker could not listen');
assert.strictEqual(port1, port1 | 0, `first worker could not listen on port ${port1}`);
const worker2 = cluster.fork();

worker2.on('message', function(port2) {
assert.strictEqual(port2, port2 | 0, 'second worker could not listen');
assert.strictEqual(port2, port2 | 0, `second worker could not listen on port ${port2}`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fail the linter, unfortunately. Same above.

You could instead realign like so:

      assert.strictEqual(port2, port2 | 0,
                         `second worker could not listen on port ${port2}`);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternative would be to just remove the message altogether and instead show the default error message. That would also be fine with me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and removed it.

assert.notStrictEqual(port1, port2, 'ports should not be equal');
worker1.kill();
worker2.kill();
Expand All @@ -28,7 +28,7 @@ if (cluster.isMaster) {

server.listen({
port: 0,
exclusive: true
exclusive: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: please remove the comma here since it's an unrelated change. Thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comma is still here after the update. As it's not related to this PR, could you please remove it?

}, function() {
process.send(server.address().port);
});
Expand Down