Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit cd2d3ae

Browse files
committed
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.
1 parent 76b9846 commit cd2d3ae

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test/simple/test-net-listen-fd0.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,15 @@ var net = require('net');
2626
var gotError = false;
2727

2828
process.on('exit', function() {
29-
assert.equal(gotError, true);
29+
assert(gotError instanceof Error);
3030
});
3131

3232
// this should fail with an async EINVAL error, not throw an exception
3333
net.createServer(assert.fail).listen({fd:0}).on('error', function(e) {
34-
assert.equal(e.code, 'EINVAL');
35-
gotError = true;
34+
switch(e.code) {
35+
case 'EINVAL':
36+
case 'ENOTSOCK':
37+
gotError = e;
38+
break
39+
}
3640
});

0 commit comments

Comments
 (0)