Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b033d38

Browse filesBrowse files
daxlabMylesBorins
authored andcommitted
test: Update test-http-parser-free to use countdown timer
PR-URL: #17322 Refs: #17169 Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 4a749c3 commit b033d38
Copy full SHA for b033d38

File tree

Expand file treeCollapse file tree

1 file changed

+4
-8
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-8
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-http-parser-free.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-parser-free.js
+4-8Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@
2323
require('../common');
2424
const assert = require('assert');
2525
const http = require('http');
26+
const Countdown = require('../common/countdown');
2627
const N = 100;
27-
let responses = 0;
2828

2929
const server = http.createServer(function(req, res) {
3030
res.end('Hello');
3131
});
3232

33+
const countdown = new Countdown(N, () => server.close());
34+
3335
server.listen(0, function() {
3436
http.globalAgent.maxSockets = 1;
3537
let parser;
@@ -42,15 +44,9 @@ server.listen(0, function() {
4244
assert.strictEqual(req.parser, parser);
4345
}
4446

45-
if (++responses === N) {
46-
server.close();
47-
}
47+
countdown.dec();
4848
res.resume();
4949
});
5050
})(i);
5151
}
5252
});
53-
54-
process.on('exit', function() {
55-
assert.strictEqual(responses, N);
56-
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.