Skip to content

Commit

Permalink
Fixes: nodejs#17169 (test-http-exceptions)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bamieh committed Feb 7, 2018
1 parent c0762c2 commit f802a56
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/parallel/test-http-exceptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@

'use strict';
require('../common');
const Countdown = require('../common/countdown');
const http = require('http');
const NUMBER_OF_EXCEPTIONS = 4;
const countdown = new Countdown(NUMBER_OF_EXCEPTIONS, () => process.exit(0));

const server = http.createServer(function(req, res) {
intentionally_not_defined(); // eslint-disable-line no-undef
Expand All @@ -30,16 +33,15 @@ const server = http.createServer(function(req, res) {
res.end();
});


server.listen(0, function() {
for (let i = 0; i < 4; i += 1) {
for (let i = 0; i < NUMBER_OF_EXCEPTIONS; i += 1) {
http.get({ port: this.address().port, path: `/busy/${i}` });
}
});

let exception_count = 0;

process.on('uncaughtException', function(err) {
console.log(`Caught an exception: ${err}`);
if (err.name === 'AssertionError') throw err;
if (++exception_count === 4) process.exit(0);
countdown.dec();
});

0 comments on commit f802a56

Please sign in to comment.