Skip to content

Commit b525950

Browse files
committed
test-unix-domain-socket.js: test reverted to previous version, added if-clause in the beginning
Reverted the test to the previous behaviour and added an IF-Clause in the beginning that skips the test if ```windir``` is set.
1 parent 53d1e64 commit b525950

File tree

1 file changed

+18
-24
lines changed

1 file changed

+18
-24
lines changed
Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,42 @@
11
/**
2-
* If on a windows system, there are no unix sockets.
3-
* So we skip this test and defaulting the asserts in the
4-
* process.on('exit', [...]) function to false, when we find the
5-
* enviroment variable 'windir' is set. I assume 'windir' will not be set on
6-
* *nix-systems.
2+
* This test is skipped, if the environment variable "windir" is set.
3+
* It assumes that it runs on a windows system then.
74
*/
5+
if (process.env.windir) {
6+
return console.log('Skipping "test-unix-domain-socket.js" - Environment'
7+
+ ' variable "windir" is set. Skipping this, because we seem to be on'
8+
+ ' a windows system');
9+
}
810
var common = require('../../common');
911
var connection = common.createConnection({socketPath: common.fakeServerSocket});
1012
var assert = require('assert');
1113

1214
var server = common.createFakeServer();
1315
var didConnect = false;
14-
if (!process.env.windir) {
15-
server.listen(common.fakeServerSocket, function(err) {
16-
if (err) throw err;
1716

18-
connection.connect(function(err) {
17+
server.listen(common.fakeServerSocket, function(err) {
18+
if (err) throw err;
19+
20+
connection.connect(function(err) {
1921
if (err) throw err;
2022

2123
assert.equal(didConnect, false);
2224
didConnect = true;
2325

2426
connection.destroy();
2527
server.destroy();
26-
});
2728
});
28-
}
29+
});
2930

3031
var hadConnection = false;
31-
if (!process.env.windir) {
32-
server.on('connection', function(connection) {
33-
connection.handshake();
32+
server.on('connection', function(connection) {
33+
connection.handshake();
3434

35-
assert.equal(hadConnection, false);
36-
hadConnection = true;
37-
});
38-
}
35+
assert.equal(hadConnection, false);
36+
hadConnection = true;
37+
});
3938

4039
process.on('exit', function() {
41-
if (process.env.windir) {
42-
assert.equal(didConnect, false);
43-
assert.equal(hadConnection, false);
44-
} else {
4540
assert.equal(didConnect, true);
4641
assert.equal(hadConnection, true);
47-
}
48-
});
42+
});

0 commit comments

Comments
 (0)