GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: fix test-net-settimeout flakiness · nodejs/node@37cc249

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-net-settimeout.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-net-settimeout.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-net-settimeout.js
+11-9Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,24 @@ const assert = require('assert');
88

99
const T = 100;
1010

11-
const server = net.createServer(function(c) {
11+
const server = net.createServer(common.mustCall((c) => {
1212
c.write('hello');
13-
});
13+
}));
14+
1415
server.listen(common.PORT);
1516

1617
const socket = net.createConnection(common.PORT, 'localhost');
1718

18-
const s = socket.setTimeout(T, function() {
19+
const s = socket.setTimeout(T, () => {
1920
common.fail('Socket timeout event is not expected to fire');
2021
});
2122
assert.ok(s instanceof net.Socket);
2223

23-
socket.setTimeout(0);
24-
25-
setTimeout(function() {
26-
socket.destroy();
27-
server.close();
28-
}, T * 2);
24+
socket.on('data', common.mustCall(() => {
25+
setTimeout(function() {
26+
socket.destroy();
27+
server.close();
28+
}, T * 2);
29+
}));
2930

31+
socket.setTimeout(0);

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.