From cd2d3aedaab5cb1a19794ca3ca50d7436ed424cf Mon Sep 17 00:00:00 2001 From: Timothy J Fontaine Date: Mon, 27 Jan 2014 17:39:45 -0800 Subject: [PATCH] test: fix test-net-listen-fd0 for pipes In the case of a pipe'd input, i.e. from the CI the fd will be a PIPE and when listen() is called it will return ENOTSOCK instead of EINVAL. --- test/simple/test-net-listen-fd0.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/simple/test-net-listen-fd0.js b/test/simple/test-net-listen-fd0.js index ba0d5984193..ac5896ee8f9 100644 --- a/test/simple/test-net-listen-fd0.js +++ b/test/simple/test-net-listen-fd0.js @@ -26,11 +26,15 @@ var net = require('net'); var gotError = false; process.on('exit', function() { - assert.equal(gotError, true); + assert(gotError instanceof Error); }); // this should fail with an async EINVAL error, not throw an exception net.createServer(assert.fail).listen({fd:0}).on('error', function(e) { - assert.equal(e.code, 'EINVAL'); - gotError = true; + switch(e.code) { + case 'EINVAL': + case 'ENOTSOCK': + gotError = e; + break + } });