diff --git a/test/parallel/test-http-abort-before-end.js b/test/parallel/test-http-abort-before-end.js index f8e0272d43e088..4dc2185ad6429b 100644 --- a/test/parallel/test-http-abort-before-end.js +++ b/test/parallel/test-http-abort-before-end.js @@ -1,25 +1,22 @@ 'use strict'; const common = require('../common'); const http = require('http'); -const assert = require('assert'); const server = http.createServer(common.mustNotCall()); -server.listen(0, function() { +server.listen(0, common.mustCall(() => { const req = http.request({ method: 'GET', host: '127.0.0.1', - port: this.address().port + port: server.address().port }); - req.on('error', function(ex) { - // https://github.com/joyent/node/issues/1399#issuecomment-2597359 - // abort() should emit an Error, not the net.Socket object - assert(ex instanceof Error); - }); + req.on('abort', common.mustCall(() => { + server.close(); + })); + + req.on('error', common.mustNotCall()); req.abort(); req.end(); - - server.close(); -}); +}));