mirror of
https://github.com/nodejs/node.git
synced 2024-11-24 20:29:23 +01:00
3d2aef3979
Use assert.strictEqual instead of assert.equal in tests, manually convert types where necessary. PR-URL: https://github.com/nodejs/node/pull/10698 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
24 lines
607 B
JavaScript
24 lines
607 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const http = require('http');
|
|
|
|
const uncaughtCallback = common.mustCall(function(er) {
|
|
assert.strictEqual(er.message, 'get did fail');
|
|
});
|
|
|
|
process.on('uncaughtException', uncaughtCallback);
|
|
|
|
const server = http.createServer(function(req, res) {
|
|
res.writeHead(200, { 'Content-Type': 'text/plain' });
|
|
res.end('bye');
|
|
}).listen(0, function() {
|
|
http.get({ port: this.address().port }, function(res) {
|
|
res.resume();
|
|
throw new Error('get did fail');
|
|
}).on('close', function() {
|
|
server.close();
|
|
});
|
|
});
|